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 33426 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: 418
    • 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

Craggan

  • Newbie
  • *
  • Posts: 13
    • View Profile
Re: EVE3 to EVE4 - Big Font Display Issue
« Reply #17 on: July 30, 2024, 07:19:01 PM »


I am using the library version 5 from Rudolph.

I want to implement one single UTF8 font using EVE_cmd_fontcache() which is described  as follows:



Code: [Select]
/**
 * @brief Enable the font cache.
 * @note - Meant to be called outside display-list building.
 * @note - Includes executing the command and waiting for completion.
 * @note - Does not support burst-mode.
 */
void EVE_cmd_fontcache(uint32_t font, uint32_t ptr, uint32_t num) {

  eve_begin_cmd(CMD_FONTCACHE);
  spi_transmit_32(font);
  spi_transmit_32(ptr);
  spi_transmit_32(num);
  EVE_cs_clear();
  EVE_execute_cmd();
}

There is no burst version of it.


All examples i found here are like this:

Code: [Select]
EVE_init_flash();
EVE_cmd_flashread(MEM_FONT50, 167936, 192);
EVE_cmd_setfont2(12,MEM_FONT50-0x010000,0x010000);
EVE_cmd_fontcache(12, 0x00002000, 0x00009100);


The function "EVE_cmd_setfont2(12,MEM_FONT50-0x010000,0x010000)" is described to be used within a display list.
I can't see this here.


I have troubles to run the code.


Is there any working example for V5 ?
Logged

Rudolph

  • Sr. Member
  • ****
  • Posts: 418
    • View Profile
Re: EVE3 to EVE4 - Big Font Display Issue
« Reply #18 on: July 31, 2024, 08:50:42 PM »

The EVE_cmd_fontcache() line looks ok.

But, and I am still getting this wrong myself, CMD_SETFONT2 is generating display list commands, so it needs to be put in a display list,
this is not a direct co-processor command, more a nice shortcut to use less SPI traffic.
Like CMD_SETBITMAP.

Just a quick check with EVE Screen Editor:

CMD_SETFONT2(100, 200, 32)

->

Offset
(decimal)   Raw   Text
1   0x0500000a   BITMAP_HANDLE(10)
2   0x01000000   BITMAP_SOURCE(0)
3   0x28000000   BITMAP_LAYOUT_H(0, 0)
4   0x07000000   BITMAP_LAYOUT(ARGB1555, 0, 0)
5   0x29000000   BITMAP_SIZE_H(0, 0)
6   0x08000000   BITMAP_SIZE(NEAREST, BORDER, BORDER, 0, 0)

Ok, well, this is with no .xfont data.

Code: [Select]
EVE_cmd_dl(CMD_DLSTART);
EVE_cmd_dl(DL_CLEAR_COLOR_RGB | WHITE);
EVE_cmd_dl(DL_CLEAR | CLR_COL | CLR_STN | CLR_TAG);
EVE_cmd_setfont2(12,MEM_FONT50-0x010000,0x010000);
EVE_cmd_dl(DL_DISPLAY);
EVE_cmd_dl(CMD_SWAP);
EVE_execute_cmd();

Can't test this right away as I do not have  the right setup on my desk, but this should work better.
Logged
Pages: 1 [2]