How to identify the font type of an unknown xbf file in the program?

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

    • How to identify the font type of an unknown xbf file in the program?

      Greetings,

      Because of the needs of the project, my device can download the xbf file from the U disk to flash, but sometimes the font type of the xbf file in the U disk is unknown. Is there any way to identify the font type of xbf files and create XBF fonts dynamically? ?(

      Thanks in advance.
    • Hi,

      The last byte in the XBF file contains the font type. You can identify this byte searching for "XBF" at the end of the file. The following byte is the font type:

      C Source Code

      1. #define MODE_FONT_1EXT 3 // Monochrome mode with extended character information
      2. #define MODE_FONT_1FRM 4 // Monochrome mode with extended character information and frame
      3. #define MODE_FONT_2BPP_EXT 5 // 4 gray scales for antialiased fonts with extended character information
      4. #define MODE_FONT_4BPP_EXT 6 // 16 gray scales for antialiased fonts with extended character information

      From the given font type you can select the corresponding pointer:

      C Source Code

      1. #define GUI_XBF_TYPE_PROP_EXT &GUI_XBF_APIList_Prop_Ext
      2. #define GUI_XBF_TYPE_PROP_FRM &GUI_XBF_APIList_Prop_Frm
      3. #define GUI_XBF_TYPE_PROP_AA2_EXT &GUI_XBF_APIList_Prop_AA2_Ext
      4. #define GUI_XBF_TYPE_PROP_AA4_EXT &GUI_XBF_APIList_Prop_AA4_Ext

      The reason why there currently is no function that does this automatically is that all font types would always be referenced.

      Best regards,
      Florian
      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.
    • SEGGER - Florian wrote:

      Hi,

      The last byte in the XBF file contains the font type. You can identify this byte searching for "XBF" at the end of the file. The following byte is the font type:

      C Source Code

      1. #define MODE_FONT_1EXT 3 // Monochrome mode with extended character information
      2. #define MODE_FONT_1FRM 4 // Monochrome mode with extended character information and frame
      3. #define MODE_FONT_2BPP_EXT 5 // 4 gray scales for antialiased fonts with extended character information
      4. #define MODE_FONT_4BPP_EXT 6 // 16 gray scales for antialiased fonts with extended character information
      From the given font type you can select the corresponding pointer:

      C Source Code

      1. #define GUI_XBF_TYPE_PROP_EXT &GUI_XBF_APIList_Prop_Ext
      2. #define GUI_XBF_TYPE_PROP_FRM &GUI_XBF_APIList_Prop_Frm
      3. #define GUI_XBF_TYPE_PROP_AA2_EXT &GUI_XBF_APIList_Prop_AA2_Ext
      4. #define GUI_XBF_TYPE_PROP_AA4_EXT &GUI_XBF_APIList_Prop_AA4_Ext
      The reason why there currently is no function that does this automatically is that all font types would always be referenced.

      Best regards,
      Florian
      Thx Florian
      • Your reply helped me and solved my problem perfectly!
      • Wish you happy life

      The post was edited 1 time, last by Excalibur ().