Storing SIF font data in external flash and usage

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

    • Storing SIF font data in external flash and usage

      Hi,

      I plan to use a serial flash on QSPI for storing fonts. Can i store the font files in such type of flash memory. I came across SIF files which are binary data but how to include them while compiling the code?. If we can include them in code then how to use the SIF file data to set font for any widget.
      Can the SIF data if present in QSPI flash be directly accessible from code memory or will i have to copy it in RAM first?

      Thanks
      Regards,

      Anuj
    • Hi,

      I would advise against the use of SIF fonts, since this font format is considered obsolete. It makes more sense to use XBF fonts instead. XBF fonts can be created from installed fonts using the Font Converter tool.

      If you want to store fonts in accessible ROM, you should convert it into a normal font structure. In case you want to store the font data on external memory, you can find a sample here that demonstrates how to do this with XBF fonts.

      Best regards,

      Florian
    • Hello,

      Thanks for your reply,

      The example used a file system for accessing xbf fonts. I don't have that option.
      i want to store raw binary data on external QSPI memory and access it.
      Can XFB fonts be used to create raw binary data?

      Regards,

      Anuj
    • Hi,

      yes, you can convert the XBF file into a binary array by using the Bin2C tool.

      The array only has to be addressable. The GetData function then only has to copy the array to the source address.

      C Source Code

      1. /*********************************************************************
      2. *
      3. * _GetData
      4. */
      5. static int _GetData(U32 Off, U16 NumBytes, void * pVoid, void * pBuffer) {
      6. GUI__memcpy((char *)pBuffer, (char *)pVoid + Off, NumBytes);
      7. return 0;
      8. }
      9. /*********************************************************************
      10. *
      11. * MainTask
      12. */
      13. void MainTask(void) {
      14. GUI_FONT Font;
      15. GUI_XBF_DATA Data;
      16. GUI_Init();
      17. GUI_XBF_CreateFont(&Font, &Data, GUI_XBF_TYPE_PROP_AA4_EXT, _GetData, _acRoboto24);
      18. GUI_SetFont(&Font);
      19. while (1) {
      20. GUI_Delay(100);
      21. }
      22. }
      Display All

      Best regards,

      Florian