Extract only used characters from font file

This site uses cookies. By continuing to browse this site, you are agreeing to our Cookie Policy.

  • Extract only used characters from font file

    Hi,
    in certain examples there are only characters included which are used here. Is there an easy way to achieve that automatically?
    It is o.k. to pick some characters one by one in the font converter or even all...
    HOWEVER: now I have a chinese text to be displayed. Due to lack of memory I presently use XBF-files (completely converted font) on a SD Card (SimHei, 5 Megabytes!).
    I would like to extract only characters used in the final text (like 200 characters out of 20.000) to include them in memory directly (font.c).
    Due to the complexity of the font file format in C, the tables (GUI_CHARINFO_EXT) and links inside have to be (re-)constructed. I hope there is a tool available...
    After some testing and investigation I suggest a script that picks the unicodes of the characters used in the text as a list (ordererd by value) and that copies and links these character information together. As a result I would like to have a working font.c file. I am able to copy all things together to a new file, but some Information is missing.
    As an example I try to understand ARIAL in unicode16 converted to c file. The GUI_FontArial25_CharInfo and the used index values are not clear.
    The areas were split into sections and linked to eachother. Now I suppose I have to generate these single properties for all characters which are in one block. The next property must be the data for the next character(s) in the next related block and so on. Can you confirm this?

    I think someone already asked for an explanation of the format (stuff like GUI_CHARINFO_EXT), but got no answer...
    So my questions are:
    Is there a tool for that ? I would pay for this...
    If not, what is the secret of this font file format?
    Otherwise I have to spend some time with autohotkey and trial & error. The font converter creates all required data. So I think I do not need to understand GUI_CHARINFO_EXT, just use the lines needed for each character used in the text file...

    By the way... It is possible to create or convert specific XBF fonts via command line which are not available in the font dialog box (FontCnvSt V5.26) - like Arial Unicode MS and others. Is this some kind of restriction?

    Best regards,
    HaJoCC

    The post was edited 2 times, last by HaJoCC ().

  • Hi HaJoCC,

    if you want to have onyl required character in the final font you might want to use a pattern file.

    1. Create a pattern file:

    Create a new .txt file, enter only the required characters and save this file with Unicode encoding (important).

    2. Open the FontConvert and create a font.

    3. Disable all characters.

    4. Read pattern file: Menu 'Edit' -> 'Read pattern file' -> select previously created file. Now only the characters which are inside the pattern file should be enabled.

    5. Save Font.

    This is also explained in the emWin user manual (UM03001_emWin5.pdf) in chapter 12.11 'Pattern files'.

    You can only create fonts from those which are installed in windows.

    Some fonts may be hidden by windows to enable all fonts go to:

    Control Panel\All Control Panel Items\Fonts\Font settings

    And un-check the checkbox " Hide fonts based on language settings ". Now all Windows fonts installed on the computer should be shown in the ’Font’ dialog and are also accessible via the commandline of the FonConverter.

    Please have look at chapter 12.14 'Troubleshooting' of the user manual.

    Best regards
    Please read the forum rules before posting.

    Keep in mind, this is *not* a support forum.
    Our engineers will try to answer your questions between their projects if possible but this can be delayed by longer periods of time.
    Should you be entitled to support you can contact us via our support system: segger.com/ticket/

    Or you can contact us via e-mail.
  • Ahhh nooo!

    How easy is that? It was aleady there, right in front of me.
    It is always the same: "Read the f* manual!"
    I skipped the pattern section...

    Thank you for this hint. :cursing:

    And also thanks for the windows font settings hint.

    Best regards,
    HaJo