Unable to use XBF font on hardware with emFile file system

  • Hi,
    I am facing a problem while trying to use xbf font with external memory. We are using NAND storage and emFile file system.
    I have a demo code using the xbf font similar to the example application from emWin here: Set external XBF font (Sample) - SEGGER Knowledge Base
    To generate the xbf font, I used the Font Converter for emWin (Demo version) V6.44 tool. The simulation on VS2022 worked normally with the expected output.


    The above example code naturally uses the windows file system for this purpose.


    Here is the code I am using on the hardware.

    Here are a few changes I made from the example code provided by emWin:

    1. I ensured some of the setup happens before so I removed the call to FS_Init and FS_Mount.
    2. Made sure FS_Close is only called on a valid file pointer.
    3. Added some logs

    Here is the output I receive:

    Bash: output.log
    1398|Opening file: diskpart:1:\F2S, can it? Yes
            1398|diskpart:1:\F2S File Open Success
            1399|Font Creation success


    I have added these checks and it seems like the Font file was successfully read and font was successfully generated. Still I only see a blank red screen with no text.

    I am using:
    1. emWin V6.38
    2. Font Converted (Demo Version) V6.44
    3. emFile V5.28


    Is there any other way to check if the XBF font is successfully loaded and ready to use?

    Edited once, last by sarthak: Typo Using emWin V6.38 and not 28 (March 5, 2025 at 8:39 PM).

  • Solved!

    I was facing the issue importing the XBF Font example specifically onto our hardware.
    The example was working fine with the simulator on Windows but it was printing nothing on our hardware.

    I believe the issue was timing. On the simulator, emwin is executed with an extra thread running in the background simultaneously (GUI_Exec), so compute intensive tasks like loading the font from the file, reading the file can be offloaded to the extra thread.

    Our hardware only has a single thread running the User Interface. The GUI_Delay(100) function stalls the processor and could lead to timing issues while doing other tasks (such as reading a file).

    When I imported the the FS_FOpen and GUI_XBF_CreateFont functions directly into our own custom sample code, it was working fine and we could see the text from the XBF font.

Participate now!

Don’t have an account yet? Register yourself now and be a part of our community!