String is not completely displayed using TTF!

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

  • String is not completely displayed using TTF!

    Hi,

    I'm using STemWin to display multi-language font(Google Noto Sans), and Everything is working except that sometimes whole sentence is not displayed.

    For example, if I want to display "In another moment \n", sometimes the LCD only shows "in another mom".

    It seems line-based problem and always the end of sentence(right-end) is skipped.

    I'm using GUI_TTF engine and suspecting that when GUI_TTF_CreateFont() (or GUI_TTF_CreateFontAA()) is called, it doesn't get the width information of each character.

    I've been testing different fonts, different boards(including STM32F769I-EVAL and custom board), and different strings, different display locations, different emWin APIs(GUI_DispString / GUI_DispStringAt....)

    but this problem won't seem to go away.



    Here's some solutions I've been discovered:

    1. When display string, separating the whole sentence char by char solves the problem.


    Here's the API I wrote to do this:

    C Source Code

    1. void DispCharByChar(char * string)
    2. {
    3. char *pstr, pdest[4], octet;
    4. int size, numbyte, strlength;
    5. pstr = string;
    6. size = GUI_UC_GetCharSize(pstr);
    7. for (; *string; ++string)
    8. {
    9. if ((*string & 0xC0) != 0x80)
    10. {
    11. ++strlength;
    12. }
    13. }
    14. while(strlength)
    15. {
    16. for(numbyte = 0; numbyte < size; numbyte++)
    17. {
    18. octet = *(pstr + numbyte);
    19. pdest[numbyte] = octet;
    20. }
    21. pdest[numbyte] = 0; //insert null character to end the single-character string
    22. GUI_UC_SetEncodeUTF8();
    23. GUI_DispString(pdest);
    24. pstr += size;
    25. size = GUI_UC_GetCharSize(pstr);
    26. strlength--;
    27. }
    28. }
    Display All

    2. If I input long blank at the end of the string like "In another moment         " solves the problem.


    What I want to do is to use variety of String Display APIs STemWin offers!

    Thanks for your help in advance!

    Regards,
    Boram

    The post was edited 3 times, last by mcubebry ().

  • Hi,

    Indeed, it seems there is something working properly. We will check this and fixes this as soon as possible.

    On our side it disappeared after we a call of GUI_DispChar(' ') (it is a space character). Please try if this works on your side.

    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.