Tuesday, February 20th 2018, 10:27am UTC+1

You are not logged in.

  • Login
  • Register

Dear visitor, welcome to SEGGER Forum. If this is your first visit here, please read the Help. It explains how this page works. You must be registered before you can use all the page's features. Please use the registration form, to register here or read more information about the registration process. If you are already registered, please login here.



Date of registration: Jun 16th 2017

Posts: 6


Wednesday, October 11th 2017, 9:00am

GUI_TTF_CreateFontAA() does not work!


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.


Source code

	GUI_TTF_DATA  NotoSansData;
  GUI_TTF_CS    NotoSans48CS; GUI_FONT      NotoSans48;  GUI_FONT      NotoSansNoAA;
  NotoSansData.pData = &_acNotoSans_Regular;  NotoSansData.NumBytes = sizeof(_acNotoSans_Regular);
  NotoSans48CS.pTTF = &NotoSansData;  NotoSans48CS.PixelHeight = 72;  NotoSans48CS.FaceIndex = 0;
  GUI_UC_SetEncodeUTF8(); GUI_TTF_SetCacheSize(1, 1, 100000); 
 GUI_TTF_CreateFontAA(&NotoSans48, &NotoSans48CS); 
 //GUI_SetTextMode(GUI_TM_NORMAL);  GUI_SetTextMode(GUI_TM_TRANS);
  GUI_SetBkColor(0xffffffff);  GUI_Clear(); 
  DispCharByChar("NotoSans AA \n"); 
 GUI_TTF_CreateFont(&NotoSansNoAA, &NotoSans48CS);
  GUI_SetFont(&NotoSansNoAA);  DispCharByChar("NotoSans noAA \n");

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.
mcubebry has attached the following images:
  • image1.JPG
  • image2.jpg

This post has been edited 3 times, last edit by "mcubebry" (Oct 11th 2017, 9:29am)

SEGGER - Schoenen

Super Moderator

Date of registration: Aug 13th 2015

Posts: 494


Wednesday, October 11th 2017, 10:56am


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

Which color conversion are you using?




Date of registration: Jun 16th 2017

Posts: 6


Thursday, October 12th 2017, 3:06am

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.

mcubebry has attached the following file:
  • conf.zip (8.48 kB - 43 times downloaded - Last download: Feb 11th 2018, 3:29pm)

SEGGER - Schoenen

Super Moderator

Date of registration: Aug 13th 2015

Posts: 494


Friday, October 13th 2017, 2:45pm


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.