Skip to main content
John Devereux
Associate II
November 7, 2019
Solved

4.12.3 incorrect font generation compared to 4.10? Flash usage increased by 400kB

  • November 7, 2019
  • 7 replies
  • 2360 views

Hi

There seems to be something wrong with font compilation on my system after updating from 4.10 to 4.12.3. The flash usage of my project has ballooned by 400kB more now. I have traced this to the font generator. This is now including a lot of spurious characters that are not used as far as I can tell.

The .txt files in generated/fonts seem to have the required subset of glyphs listed. But the .cpp files include a lot of strange extra code points like 0xE000-0xE14A ("private use" range). And U+0915..U+0963 ("Devanagari").

This is when generating code from Designer which looks like it calls

make -f simulator/gcc/Makefile assets -j10

to generate the assets?

I tried one of the stock projects and this does seem to work OK.

Windows 10 is set to English/United Kingdom.

Any ideas?

thanks

John

This topic has been closed for replies.
Best answer by John Devereux

Hi Martin

Thanks for the response. I downloaded a different copy of the same font and it works fine, so I guess the original was corrupt or incompatible somehow.

The original file was timestamped 2002...

Before that I replicated the problem with a fresh minimal project:

  • create empty UI for simulator only
  • place background
  • place textarea with a few ascii and CJK characters: "New Text 测试�?�"
  • change Default typography to "Arial Unicode MS"
  • Generate Code

This results in a set of generated font .cpp files

-rw-r--r-- 1 jd 197121 797 Nov 9 12:31 ApplicationFontProvider.cpp
-rw-r--r-- 1 jd 197121 1550 Nov 9 12:27 CachedFont.cpp
-rw-r--r-- 1 jd 197121 3657 Nov 9 12:31 Font_ARIALUNI_TTF_20_4bpp_0.cpp
-rw-r--r-- 1 jd 197121 21460 Nov 9 12:31 Font_ARIALUNI_TTF_20_4bpp_1.cpp
-rw-r--r-- 1 jd 197121 1232 Nov 9 12:31 Font_ARIALUNI_TTF_20_4bpp_10.cpp
-rw-r--r-- 1 jd 197121 1232 Nov 9 12:31 Font_ARIALUNI_TTF_20_4bpp_13.cpp
-rw-r--r-- 1 jd 197121 1232 Nov 9 12:31 Font_ARIALUNI_TTF_20_4bpp_17.cpp
-rw-r--r-- 1 jd 197121 220561 Nov 9 12:31 Font_ARIALUNI_TTF_20_4bpp_28.cpp
-rw-r--r-- 1 jd 197121 353 Nov 9 12:27 Font_verdana_10_4bpp_0.cpp
-rw-r--r-- 1 jd 197121 1963 Nov 9 12:27 Font_verdana_40_4bpp_0.cpp
-rw-r--r-- 1 jd 197121 8154 Nov 9 12:27 FontCache.cpp
-rw-r--r-- 1 jd 197121 1499 Nov 9 12:27 GeneratedFont.cpp
-rw-r--r-- 1 jd 197121 201 Nov 9 12:31 Kerning_ARIALUNI_TTF_20_4bpp.cpp
-rw-r--r-- 1 jd 197121 196 Nov 9 12:27 Kerning_verdana_10_4bpp.cpp
-rw-r--r-- 1 jd 197121 196 Nov 9 12:27 Kerning_verdana_40_4bpp.cpp
-rw-r--r-- 1 jd 197121 59300 Nov 9 12:31 Table_ARIALUNI_TTF_20_4bpp.cpp
-rw-r--r-- 1 jd 197121 874 Nov 9 12:27 Table_verdana_10_4bpp.cpp
-rw-r--r-- 1 jd 197121 874 Nov 9 12:27 Table_verdana_40_4bpp.cpp

Font_ARIALUNI_TTF_20_4bpp_28.cpp contains the 0xE000 - 0xE14A code points.

Font_ARIALUNI_TTF_20_4bpp_1.cpp contains 0x91C - 0x963, with a few gaps.

After updating the font the problem went away.

Thanks

John

7 replies

John Devereux
Associate II
November 7, 2019

UPDATE: This seems to have been triggered by the particular font used (ARIALUNI.TTF). There are CJK characters used in the application. Changing the font to google NotoSansCJKsc-Regular.ttf avoids the problem and flash usage is back to normal. So possibly there is corruption in the font or a bug in the generation code.

The new font looks irregular for some reason but the original problem is fixed or at least worked around.

Thanks

John

Martin KJELDSEN
Principal III
November 8, 2019

Thanks, @John Devereux​,

I'll see if there's a general issue here. Strange that there are additional code points if your text does not include any Hindi unicodes.

0xE000-0xE14A ("private use" range) and U+0915..U+0963 ("Devanagari") are specifically for Hindi.

/Martin

John Devereux
John DevereuxAuthorBest answer
Associate II
November 9, 2019

Hi Martin

Thanks for the response. I downloaded a different copy of the same font and it works fine, so I guess the original was corrupt or incompatible somehow.

The original file was timestamped 2002...

Before that I replicated the problem with a fresh minimal project:

  • create empty UI for simulator only
  • place background
  • place textarea with a few ascii and CJK characters: "New Text 测试�?�"
  • change Default typography to "Arial Unicode MS"
  • Generate Code

This results in a set of generated font .cpp files

-rw-r--r-- 1 jd 197121 797 Nov 9 12:31 ApplicationFontProvider.cpp
-rw-r--r-- 1 jd 197121 1550 Nov 9 12:27 CachedFont.cpp
-rw-r--r-- 1 jd 197121 3657 Nov 9 12:31 Font_ARIALUNI_TTF_20_4bpp_0.cpp
-rw-r--r-- 1 jd 197121 21460 Nov 9 12:31 Font_ARIALUNI_TTF_20_4bpp_1.cpp
-rw-r--r-- 1 jd 197121 1232 Nov 9 12:31 Font_ARIALUNI_TTF_20_4bpp_10.cpp
-rw-r--r-- 1 jd 197121 1232 Nov 9 12:31 Font_ARIALUNI_TTF_20_4bpp_13.cpp
-rw-r--r-- 1 jd 197121 1232 Nov 9 12:31 Font_ARIALUNI_TTF_20_4bpp_17.cpp
-rw-r--r-- 1 jd 197121 220561 Nov 9 12:31 Font_ARIALUNI_TTF_20_4bpp_28.cpp
-rw-r--r-- 1 jd 197121 353 Nov 9 12:27 Font_verdana_10_4bpp_0.cpp
-rw-r--r-- 1 jd 197121 1963 Nov 9 12:27 Font_verdana_40_4bpp_0.cpp
-rw-r--r-- 1 jd 197121 8154 Nov 9 12:27 FontCache.cpp
-rw-r--r-- 1 jd 197121 1499 Nov 9 12:27 GeneratedFont.cpp
-rw-r--r-- 1 jd 197121 201 Nov 9 12:31 Kerning_ARIALUNI_TTF_20_4bpp.cpp
-rw-r--r-- 1 jd 197121 196 Nov 9 12:27 Kerning_verdana_10_4bpp.cpp
-rw-r--r-- 1 jd 197121 196 Nov 9 12:27 Kerning_verdana_40_4bpp.cpp
-rw-r--r-- 1 jd 197121 59300 Nov 9 12:31 Table_ARIALUNI_TTF_20_4bpp.cpp
-rw-r--r-- 1 jd 197121 874 Nov 9 12:27 Table_verdana_10_4bpp.cpp
-rw-r--r-- 1 jd 197121 874 Nov 9 12:27 Table_verdana_40_4bpp.cpp

Font_ARIALUNI_TTF_20_4bpp_28.cpp contains the 0xE000 - 0xE14A code points.

Font_ARIALUNI_TTF_20_4bpp_1.cpp contains 0x91C - 0x963, with a few gaps.

After updating the font the problem went away.

Thanks

John

Martin KJELDSEN
Principal III
November 11, 2019

That's good news. But still a bit peculiar that you're getting code for unicodes that are not at all in your application. Maybe a corrupt font can cheat the font converter in some way - I'm not sure it will be top priority to look into this. But, in some cases i guess the problem could be small enough for someone to not notice and take up extra flash memory for generated typographies.

Thanks for the feedback!

/Martin

Marco.R
Senior
November 13, 2019

​Hi @Martin KJELDSEN​ 

I've the same problem with another font. But I've not the possiblities to exchange or redownload the font. I'd be very grateful if you could investigate what the problem is. I sent you the font a while back.

Thanks

/Marco

Martin KJELDSEN
Principal III
December 2, 2019

You can use a tool like font-forge to inspect the font to check if the glyphs are event present in your font.

/Martin

Marco.R
Senior
December 2, 2019

Hi @Martin KJELDSEN​ 

Thanks for the hint for the tool but it doesn't resolve the main issue. TouchGFX is generating more glyphs than used. This occurs only since version 4.12.3 of TouchGFX. With TouchGFX 4.10.0 it worked correctly. The generation of font assets seems to be different between 4.10.0 and 4.12.3.

John solved this problem by downloading a different font, but I don't have this option.

I'm looking forward to the next touchgfx version in the hope that this issue is solved.

When necessary I can send you the font for investigation.

Thanks

Marco

John Devereux
Associate II
December 2, 2019

Hi Marco

You could try using font forge to load and then save the original font and see if the problem goes away? Might be worth a try I think for you.

thanks

John

Marco.R
Senior
December 3, 2019

Hi @John Devereux​ 

Thanks for your hint. I tried it, but unfortunately the result is the same.

Marco