This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

Using new fonts on LM4F232 Eval Board

Hi,

I'm currently working on the LM4F232 Eval Board. I have trouble trying to use the Arial Font that I have converted using the ftrasterize tool.

I have successful converted the .ttf files to the C source. I have also place the converted C files into the Font folder in the grlib folder.

The codes that I use to display as follow:

//background widget
Canvas(g_sForeground, &g_sBackground, 0, 0 ,
&g_sCFAL96x64x16, 10, 10, 96, 64,
(CANVAS_STYLE_FILL | CANVAS_STYLE_TEXT | CANVAS_STYLE_TEXT_LEFT | CANVAS_STYLE_TEXT_TOP ),
ClrGreen, 0, ClrBlack,
g_sFontFont24, "Test", 0, 0);

However there are 3 errors:

Description Resource Path Location Type
#10010 errors encountered during linking; "GraphicsWidget.out" not GraphicsWidget C/C++ Problem
#10234-D</a> unresolved symbols remain GraphicsWidget C/C++ Problem
unresolved symbol g_sFontFont24, first referenced in ./main.obj GraphicsWidget C/C++ Problem

I am assuming there are some issues with the linking as I have also included the new font header in the grlib.h already.

  • This is the kind of error I would expect if you failed to add the new font's C file to your project. If the C file is definitely in the list being linked, check the name of the font inside the file and make sure that it is "g_sFontFont24". Did you mean to type "FontFont", for example?

  • Hi Dave,

    thanks for the advice. I have added into the project explorer. After fiddling with the codes, it turns out that I did not declared the following on the main c file:

    extern tFont gsFontFont24;

    Just another quick question, if I were to add in the following:

    extern const tFont g_sFontFont24;
    #define g_sFontFont24 (const tFont *)&g_sFontFont24

    in grlib.h, would it be possible? It is because I have tried adding that command in the grlib and it does not work and give me the same error as I have given. 

    Many thanks in advance!

    Wai Sing

     

  • I suspect you have a basic misunderstanding of how C applications are built. You have added a new, application-specific resource to your project (your font) so you need to add references to it to some application-specific header file. This font is not part of the Stellaris graphics library so adding references to it in grlib.h would be a bad idea - as soon as you take a software update from us, your changes would be deleted and you would need to reapply them.

    If you have a header file for your application, add the extern reference to your font there along with all the other things that you need to share between application files. Note that the #define you provide will generate a compiler error. You can't #define a label that shares a name with a variable (g_sFontFont24 in this case).

    The original error you quoted indicated that you had not passed any file to the linker that contained the actual data for g_sFontFont24. The fix you mention here won't fix that If a missing extern reference had been the only problem, you would have seen a warning from the compiler but no error from the linker. The extern reference would fix this but unless you add a C file that contains the actual data for the font, your linker error will remain.

  • Hi Dave,

    Thanks for the enlightenment! Will re-work my codes according to your instructions!

    Many thanks!

    Merry Christmas in advance!

    Wai Sing