Supporting Chinese and Korean in STemwin

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

    • Supporting Chinese and Korean in STemwin

      Hi,
      I need to use Chinese and Korean languages in the GUI. Size of .c files generated using Font Cvt software is huge and the flash is not enough to accommodate.
      Is there any other way to handle such languages ?

      In the user manual, another technique is suggested i.e using .XBF files . How to use such file?
    • Hi,

      Fonts can get really big and might exceed the limits of embedded hardware.

      You have multiple options to save memory. First might be to use an xbf file placed on external memory and access it by a file system.

      For this purpose you have to use a GetData() function to access the file. Below is an example on how to access a xbf file on your HD using window FS API:

      C Source Code

      1. #include <windows.h>
      2. #include "DIALOG.h"
      3. static int _cbGetData(U32 Off, U16 NumBytes, void * pVoid, void * pBuffer) {
      4. DWORD NumBytesRead;
      5. HANDLE hFile;
      6. hFile = *(HANDLE *)pVoid;
      7. /* Set file pointer to the requested position */
      8. if (SetFilePointer(hFile, Off, 0, FILE_BEGIN) == 0xFFFFFFFF) {
      9. return 1; /* Error */
      10. }
      11. /* Read font data */
      12. if (!ReadFile(hFile, pBuffer, NumBytes, &NumBytesRead, 0)) {
      13. return 1; /* Error */
      14. }
      15. if (NumBytesRead != NumBytes) {
      16. return 1; /* Error */
      17. }
      18. return 0; /* Ok */
      19. }
      20. void MainTask(void) {
      21. GUI_FONT Font;
      22. GUI_XBF_DATA XBF_Data;
      23. HANDLE hFile;
      24. GUI_Init();
      25. hFile = CreateFile("c:\\temp\\Arial32.xbf", GENERIC_READ, 0, 0, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, 0);
      26. GUI_XBF_CreateFont(&Font, /* Pointer to GUI_FONT structure in RAM */
      27. &XBF_Data, /* Pointer to GUI_XBF_DATA structure in RAM */
      28. GUI_XBF_TYPE_PROP, /* Font type to be created */
      29. _cbGetData, /* Pointer to callback function */
      30. &hFile); /* Pointer to be passed to GetData function */
      31. GUI_DispString("Das ist ein Test!");
      32. while (1) {
      33. GUI_Delay(100);
      34. }
      35. }
      Display All

      Another method is to use a pattern file which includes any string used in your application and can be used to redruce the content of font to only the required characters.

      THis is described in chapter 12.11 Pattern files of the emWin user manual.

      The advantage of the first method is that you have always all characters available and should be used if you have dynamic strings.
      The second one might be the method which saves more memory but can't b used for dynamic strings because it might happen that required characters are not included.

      Regards,
      Sven
      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.
    • Thank you for the reply.



      One more clarification, If external storage like SD Card is not available, then where can we store the XBF file?

      In that case, is the second method what you have described more suitable?
    • Hi,

      It doesn't has to be an SD card it can also be any other memory. How you get the data is defined in the GetData() function, which has to be done by the user.

      With the second method it might get easier if the shrinked font will fit into memory available after shrinking.

      Regards,
      Sven
      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.
    • Hi,

      Yes, you can store the .xbf file in flash memory, too. I guess we don't have a dedicated example on how to do this.
      But, take a look into the examples attached maybe it is something you are looking for.

      Regards,
      Sven
      Files
      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.
    • Thank you so much. I will look into the examples.



      I'm facing a problem with emwin Font converter tool.

      i.e not able to generate .c file for font < DMFinBeiJing to support Traditional chinese texts in my GUI. What could be the problem?




      -Regards,

      Manasa
    • Hi,

      what kind of font is this?
      Is it a ttf file?
      What do you mean by not able to generate a c-file?
      Does it produce a strange output?
      Does the tool crash?

      Regards,
      Sven
      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.
    • Hi,

      When clicking on save, what does it say in the lower left corner of the Font Converter?

      Please note that it might take a while if you create large fonts.

      Regards,
      Sven
      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.
    • If it is converting then, it will show as Reading characters followed by Ready at the lower left corner. Is that right?

      In my case, Reading characters doesn't appear for this particular font.

      I have attached the screenshot. Kindly check.



      Regards,

      Manasa
    • Hi,

      Is it possible to send me the font file or provide me with a download link?

      Regards,
      Sven
      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.
    • Hi,

      xbf fonts require almost no additional RAM. Just a few bytes for the GUI_XBF_DATA and the GUI_FONT structures.



      HulkHogan wrote:

      when in use does it only create the characters you need or does it create the entire font?
      Yes, only those characters are getting loading which are required. When displaying a string emWin only loads those characters required to display this string.

      Of course, you could use a pattern file while creating the font with the Font Converter. This would reduce the number of available characters in the font file itself and helps to keep it small.

      Regards,
      Sven
      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.
    • HI,

      Unfortunately, there is no example available for fonts inside QSPI flash.

      Attached is an example which shows how to use XBF files from a file system and how to read XBF data from memory. The example is made to be used in the emWin Simulation (using Windows FS) but it should be quite easy to port it to any other file system.

      Depending on where you place the file 'ExtBinFont.xbf' you have to adapt the variable acPath in MainTask().

      Regards,
      Sven
      Files
      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.