I realized that the lvgl font converter not only produces const structures, but also modifiable ones. Specifically lv_font_fmt_txt_dsc_t and lv_font_t structures. Wanting to save some RAM, I went ahead and made them all const. Running the code like that led me to a segmentation fault, as in get_glyph_dsc_id some of the font_dsc fields are modified, due to a caching logic.
I’d like to suggest the following:
- Hide this caching logic behind a compile switch (e.g. #if (LV_FONT_CACHE != 0))
- Make lv_font_t and lv_font_fmt_txt_dsc_t structures const
- If the font cache is enabled, add a cache pointer to lv_font_fmt_txt_dsc_t structure, that points to the separate non-const cache structure