Add a custom font to emWin library, for PSoC 6 with a TFT display

Tip / Sign in to post questions, reply, level up, and achieve exciting badges. Know more

cross mob
Niek
Level 1
Level 1
First like received 5 sign-ins First reply posted

 

Hey,

How do I add a custom font to the emwin library and GUI?

I have generated a .c file from a font using the Segger font converter. But I can't get it to work with the library. My setup is the CY8CKIT-062-WIFI-BT with a TFT display. The display works fine without the custom font.

Thank you,
Niek

 

1 Solution
Rakshith
Moderator
Moderator
Moderator
250 likes received 1000 replies posted 750 replies posted

Hi @Niek

I am sorry I am not sure I understood your query. 

If you are referring to adding a .c file into a PSoC Creator project then here are the steps - 

  • Place the .c file in the project directory. 
  • In PSoC Creator Workspace Explorer (the left panel next to the editor) you should be able to find a folder called Source Files
  • Right-click on the folder and select Add > Existing Item and select the .c file. 

The .c file should now be included in the project. 

Also, please ensure you have added the font structure extern variable in your project -

Rakshith_0-1621364946792.png

If this does not work, can you please share your font .c file so that I can try adding it to an example project?

Thanks and Regards,
Rakshith M B

View solution in original post

4 Replies
Rakshith
Moderator
Moderator
Moderator
250 likes received 1000 replies posted 750 replies posted

Hi Niek, 

Can you please let me know how you used the font to test it out? I think you should be able to use the font using the GUI_SetFont() API. 

Rakshith_0-1620847383513.png

The Segger emWin User Guide also provides few examples of the resulting C file (Page 262). Can you please confirm that the C file structure is similar? If so, can you please share the generated C file so that I can try to recreate the issue at my end?

Thanks and Regards,
Rakshith M B
0 Likes
Niek
Level 1
Level 1
First like received 5 sign-ins First reply posted

Heey Rakshith,

Thanks for your response. Im now using a font as follows:

Niek_0-1620977230567.png

But I don't want to use the standard fonts, I want to use a custom font which i generated with the segger font tool. The problem is that I don't  know how I can add that .c file to my project within PSoC creator. For example I want to do " GUI_SetFont (GUI_CUSTOMFONT_32);"

0 Likes
Rakshith
Moderator
Moderator
Moderator
250 likes received 1000 replies posted 750 replies posted

Hi @Niek

I am sorry I am not sure I understood your query. 

If you are referring to adding a .c file into a PSoC Creator project then here are the steps - 

  • Place the .c file in the project directory. 
  • In PSoC Creator Workspace Explorer (the left panel next to the editor) you should be able to find a folder called Source Files
  • Right-click on the folder and select Add > Existing Item and select the .c file. 

The .c file should now be included in the project. 

Also, please ensure you have added the font structure extern variable in your project -

Rakshith_0-1621364946792.png

If this does not work, can you please share your font .c file so that I can try adding it to an example project?

Thanks and Regards,
Rakshith M B
Niek
Level 1
Level 1
First like received 5 sign-ins First reply posted

Thank you Rakshith!
This solved my problem

0 Likes