BRT Community

Please login or register.

Login with username, password and session length
Advanced search  

News:

Welcome to the Bridgetek Community!

Please read our Welcome Note

Technical Support enquires
please contact the team
@ Bridgetek Support

Please refer to our website for detailed information on all our products - Bridgetek - Bridging Technology

Pages: 1 [2]

Author Topic: EVE3 to EVE4 - Big Font Display Issue  (Read 20390 times)

LaZorraBRT

  • Newbie
  • *
  • Posts: 16
    • View Profile
Re: EVE3 to EVE4 - Big Font Display Issue
« Reply #15 on: October 07, 2021, 04:26:26 AM »

Thank you so much Rudolph, I've been trying to get multiple fonts working for a long while and this was the help I needed.

Quote
And when I use FONT_FUN32 for the long text line EVE does not like that very much as the funtype 32 font no longer is cached.
So there are still limits, you can only cache one font and any uncached font needs to be either small enough to allow EVE to fetch all the glyphs in one line from the flash or you need to limit the amount of different glyphs in one line.

I did some experimenting with different size fonts and found that without caching and having a large sized font, it is very limited as to what you can display before you get artifacts / display corruption.

Displaying fonts without caching:
Size 16 - 52 character limit before corruption
size 32 - 26 character limit before corruption
size 64 - 12 character limit before corruption

With caching:
size 16 - tested up to 216 characters without issue
size 32 - tested up to 108 characters without issue
size 64 - 37 character limit before corruption

So caching makes a huge difference!

I tried multiple lines of 9 characters of the 64 pt. font and it displayed ok.  I zipped my code if it is helpful for others. 
Logged

Rudolph

  • Sr. Member
  • ****
  • Posts: 391
    • View Profile
Re: EVE3 to EVE4 - Big Font Display Issue
« Reply #16 on: October 07, 2021, 08:14:55 PM »

With caching:
size 16 - tested up to 216 characters without issue
size 32 - tested up to 108 characters without issue
size 64 - 37 character limit before corruption

Unfortunately the cache is not smart enough to allow even a single char extra.
This is why I did not only setup the font-cache but I also showed how to keep track of it.

So the limit is the size of the cache and of course you get less entries with bigger glyphs.

Outside the display-list itself there is this:
EVE_cmd_fontcachequery(&fonttotal, &fontused);

And then there is this:
EVE_cmd_text_var_burst(180, 530, FONT_NOTO040, EVE_OPT_FORMAT, "Fontcache total: %d  used: %d", 2, fonttotal, fontused);

And the result with my Notosans 40 is: "Fontcache total: 115 used: 17"
When you count, this line has 17 different characters.

The size of the font-cache in my example is 67648 bytes since it is defined to start at 0x00ee000 and the size is defined as 0x00fe840 - 0x00ee000.
#define MEM_FONTCACHE 0x000ee000
#define MEM_FONT_INCON24 0x000fe840
#define SIZE_FONTCACHE (MEM_FONT_INCON24 - MEM_FONTCACHE)

Change the first define to a lower address and you have a bigger font-cache.
I just changed it to 0x000e0000 and now the "total" is 213.

Unfortunately this is all trial and error since the font size is rather meaningless in terms of absolute numbers.
Even more so since the ASTC format seems to require full bytes and so different font sizes end up
with the same sizes for the .glyph files.

The file NotoSans-Regular_40_ASTC.glyph is 143KB and has 187 glyphs.
To make the font-cache 187 glyphs larged I needed to set the lower address to 0x000e3b00.
This makes a size of 107KB to cache every glyph which is still a win compared to copying the complete .glyph to RAM_G.
So any realistic size to set the cache at is less than size of the .glyph file.

Annother thing to keep in mind, the font-cache has to be big enough to store every unique glyph to be used
in two consecutive frames.
So it needs to be big enough to account for extra chars if you swap pages.

I just added an additional line:
EVE_cmd_text_burst(180, 560, FONT_NOTO040, 0, "The quick brown fox jumps over the lazy dog! 1234567890");

And the "used" jumped to 41.
So it is rather unlikely that there is an issue with room for 115 glyphs.

A good rule of thumb might be to set the size of the cache to half of the .glyph for a first try, maybe 2/3.
Logged
Pages: 1 [2]