Fonts and i18n in external memory

Having many languages using the i18n library eats allot of ram. Many languages have unique characters and that also adds to the fact.

I use a Teensy and so I can store the glyph_bitmap in PROGMEM, this saves allot of RAM.
But for every language added it eats 7 - 10kb of RAM and I am not sure exactly why.

My guess is that the actual glyphs are stored in PROGMEM but when they load to be displayed by LVGL they do so in RAM.

I’d like to use EXTMEM, which is actually PSRAM that I have 16MByte of on my board. So plenty of space to use.

The main issue with EXTMEM is that it’s somewhat limited.
You must declare the variable as EXTMEM outside a function and then have a function populate the variable.


EXTMEM uint8_t test;
void func() {
    test = 0x03;

I am also thinking that maybe LVGL has some sort of buffer somewhere that is put into RAM, that buffer could be put in EXTMEM instead and save RAM.

The display buffer is already in DMAMEM.

Any ideas or solutions out there?

For devices with large memory, you can consider using freetype to dynamically generate fonts.
This can save the operation of the font conversion tool on the PC.
Freetype will cache the rendered fonts into RAM. You only need to add a heap manager to manage PSRAM memory.

1 Like

Regarding the transplantation of freetype, refer to the documentation: FreeType support — LVGL documentation

1 Like

This looks very interesting and I’m gonna look into it.

To place anything in PSRAM I need to first declare a buffer of sorts outside a function. Then inside a function I can fill that buffer. Those are the rules.

Will FreeType allow me to do so?

You can refer to this file to connect the memory alloc interface of freetype to the PSRAM memory allocation interface.