GUI_TTF_CreateFontAA() does not work!

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

  • GUI_TTF_CreateFontAA() does not work!

    Hi,

    I'm using STM32F769 MCU and emWin to display text with google noto sans ttf font.
    Displaying successfully working except some problems; one I posted here before and got answer(Thanks!), and there remain two of them.

    1. As I wrote in subject, emWin provides two font-creating APIs regarding TTF; one is GUI_TTF_CreateFontAA() and the other is GUI_TTF_CreateFont().

    I tested GUI_TTF_CreateFontAA() on STM32F769I_EVAL board and checked anti-aliasing is working, but with my own board it doesn't seem to work. image 1 in the attatchment is result of using CreateFontAA() and CreateFont() from same font source.

    The font used in first line is made from GUI_TTF_CreateFontAA() and the font used in second line is made from GUI_TTF_CreateFont().

    I think AA is not working in here, and here's what I thought:

    In my board environment, I use ARGB8888 format on frame buffer side; LTDC and emWin is inited with color format ARGB8888 and the date written in frame buffer is also in same format.

    However, since my LCD display doesn't support 32 bit format, I convert the display data from LTDC into RGB888 on DSI-Host. (I inited it with color pixel format RGB888).

    So if the CreateFontAA() creates anti-aliasing effect by simply changing only the alpha data and leave the RGB, it won't show on my display because data of the alpha channel is lost.

    Is it right?

    since my board connection is more complicated than I described, current setting of configuration is the only set confirmed to be working, and I'm not sure if display will still working if I change the color pixel format of DSI-Host and afterwards.

    So I am wondering if my assumption is right, is there any way I can convert changed alpha data into changed RGB data?

    I mean, if those aliased pixels all have RGB block color(0x000000) and different alpha makes them with different color, can I get RGB data of those changed color?



    2. I cannot display text with text mode "normal". I displayed the same code with only changing in text mode: changed GUI_SetTextMode(GUI_TM_TRANS); to GUI_SetTextMode(GUI_TM_Normal); and got those results in image 2.


    Is it related with the color pixel format problem?


    How can I solve these problems?


    Anything can be really helpful for me.




    Oh and these are the source code I used to get image1 and image 2!


    I commented GUI_SetTextMode() and as I said if the normal mode is activated, the result only shows the first character "N" and ignores the rest but no hard fault or error is occured.


    The code happily reaches to while(1); loop in the end of the code.


    Thanks.



    Source Code

    1. GUI_TTF_DATA NotoSansData;
    2. GUI_TTF_CS NotoSans48CS; GUI_FONT NotoSans48; GUI_FONT NotoSansNoAA;
    3. NotoSansData.pData = &_acNotoSans_Regular; NotoSansData.NumBytes = sizeof(_acNotoSans_Regular);
    4. NotoSans48CS.pTTF = &NotoSansData; NotoSans48CS.PixelHeight = 72; NotoSans48CS.FaceIndex = 0;
    5. GUI_UC_SetEncodeUTF8(); GUI_TTF_SetCacheSize(1, 1, 100000);
    6. GUI_TTF_CreateFontAA(&NotoSans48, &NotoSans48CS);
    7. //GUI_SetTextMode(GUI_TM_NORMAL); GUI_SetTextMode(GUI_TM_TRANS);
    8. GUI_SetBkColor(0xffffffff); GUI_Clear();
    9. GUI_SetFont(&NotoSans48);
    10. DispCharByChar("NotoSans AA \n");
    11. GUI_TTF_CreateFont(&NotoSansNoAA, &NotoSans48CS);
    12. GUI_SetFont(&NotoSansNoAA); DispCharByChar("NotoSans noAA \n");
    13. while(1);
    Display All



    Thanks in advance.



    P.S. I tested http://forum.segger.com/index.php?page=Thread&postID=9063&highlight=anti#post9063 code in here, and the result was not same as it should be: upper-left corner and lower-right corner is displayed everything else is white.
    Images
    • image1.JPG

      728.33 kB, 1,819×628, viewed 597 times
    • image2.jpg

      309.96 kB, 1,129×484, viewed 572 times

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

  • Hi,

    Please post your configuration files (LCDConf.c, GUIConf.c/.h). I suspect that something is not configured properly.

    Which color conversion are you using?

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

    Thanks for the reply :D

    Here's my configuration files, and I commented initialization codes of H/W components in lcdconf.c because I'm doing the job separately.

    Thank you.

    Regards
    Boram
    Files
    • conf.zip

      (8.48 kB, downloaded 323 times, last: )
  • Hi,

    Please try to change the color conversion in your LCDConf.c to GUICC_M8888I.

    With GUICC_M8888I the a value of 0xff means opaque and a value of 0x00 is transparent. If this is mixed up, which I guess is true in your case, you will get these strange behavior with AA fonts.

    GUICC_M8888I converts the colors into a format the on board LCD controller of the STM32F7 expects when configured for 32bpp.

    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.