Add characters to a font on the fly

would it be possible to add characters after the fact?

something like:
lv_font_add_char(font, char, bytearray)? or lv_font_add_chars(font, chars, bytearray)

this would also be handy for MicroPython, where users probably play with more than one program.

see also: German umlauts

Unfortunately, I can’t imagine a good was for it as all the arrays are const.

Maybe loading fonts runtime can help:

I was thinking of a linked list of (const) arrays or collections.
like if there is an override collection, search there first, otherwise search in the original font collection.

of coarse this functionality is only needed in situations where you are running different programs often. for a single solution, an updated font will do.

for the maker/hobby world that uses MicroPython, using a default font and add chars as needed would be a great improvement i think.

To support effective searches, kerning and other features the fonts are quite compliceted.
See this for example.

The add a new font the followings needs to be updated:

  • glyph_bitmap
  • glyph_dsc to describe the the properties of the gylph
  • cmaps to organize glyphs into ranges for faster search
  • kern_left/right_class_mapping and kern_class_values for kering

So I believe it’s rather complicated. :frowning:


How can I get the Kern values i.e. kern_left/right_class_mapping and kern_class_values.
I want to add a regular play symbol to my existing font file. The rest values I can copy from the file I have generated from online font converter.

Can you use Font fallback feature? This way you can add new font to an existing one.

Is font fallback available from LVGL v8 onwards? I am using LVGL v7.11.

Correct, it appears to only be available in v8.2+, to be specific.

any other way, with v7.11? please let me know.

Is using FreeType an option for you?