Unresolved extern 'my_font' [Solved]

Cross-platform IDE for the rapid development of applications for the embedded world, available on Windows, Linux, and macOS.
Post Reply
Author
Message
frank.malik
Posts: 96
Joined: 09 Apr 2021 20:37

Unresolved extern 'my_font' [Solved]

#1 Post by frank.malik » 14 Sep 2022 18:32

Hello,

might be a simple issue, but I can't solve it.

I'm trying to print text on a tft using the gl_* functions. However, the examples don't work in NECTO 2.1.0.
Here is the part of the code

Code: Select all

extern const uint8_t* my_font;  //!<-- The font is generated by NectoStudio so extern is needed.

    gl_set_font(my_font);                   //!<-- Initialize font.
    gl_draw_text(graphName, 10, 10);    //!<-- Draw text with 'my_font' style.
In generates the error "Unresolved extern 'my_font'"

How shall I solve this?
Kind regards
Frank

Fusion for STM32 v8, STM32F407ZG@168MHz, 4" TFT capacitive
mikromedia 3, PIC32MZ2048EFH100@200MHz, 3" TFT capacitive
NECTO Studio 3.0.0, mikroC AI for ARM/PIC32, mikroSDK v.2.7.2

frank.malik
Posts: 96
Joined: 09 Apr 2021 20:37

Re: Unresolved extern 'my_font' [Solved]

#2 Post by frank.malik » 14 Sep 2022 20:03

Hello,

for all the others there.

I talk as a blind about the colours, but it seems that in NECTO Studio 2.x the Designer uses a different concept for the font setting, compared to the old implementation,
which is, by the way, not upward compatible.

In NECTO Studio 2.x there is a generated file called "resources.h", plus the corresponding .c-file. This needs to be included to use the "gl_set_font" function.
It will be generated from the Designer (?) from the screen files. If you include a font in the screen, you can use it in your code.
Define a label, use your desired font and not the name of the font shown in the properties overview.
NECTO Studio v2.1.0_FontSetting.png
NECTO Studio v2.1.0_FontSetting.png (2.3 KiB) Viewed 831 times
At the beginning of your .c-file set the include instruction like this:

Code: Select all

#include "resources.h"
In your code you might use the following instruction now:

Code: Select all

        gl_set_font(Arial_Narrow_Regular_10_159_);
This will provide you with the required font. Most of the examples use "my_font" or "test_font". In the previous version of Designer it seems that you can define aliases for fonts, like "my_font". This isn't possible
anymore in this version. Therefore most of the examples will not work under NECTO Studio 2.x
Kind regards
Frank

Fusion for STM32 v8, STM32F407ZG@168MHz, 4" TFT capacitive
mikromedia 3, PIC32MZ2048EFH100@200MHz, 3" TFT capacitive
NECTO Studio 3.0.0, mikroC AI for ARM/PIC32, mikroSDK v.2.7.2

Post Reply

Return to “IDE”