Having problems migrating custom fonts to LVGL 8

I am trying to migrate a working and stable LVGL app to 8.1.0-dev (platformio, Pico RP2040 MCU, Wizio ‘baremetal’ framework, toolchain-gccarmnoneeabi 1.70201.0 (7.2.1)).

The original custom fonts are at simple_stepper_motor_analyzer/font_montserrat_alphanum_12.cpp at main · zapta/simple_stepper_motor_analyzer · GitHub and I modified them (see below) for LVGL 8 by adding the cache and making the font struct const.

Now when I try to build I am getting the error below which goes away if I comment out the .dsc line.

Any suggestions?

src\fonts\font_montserrat_alphanum_12.cpp:1180:1: sorry, unimplemented: non-trivial designated initializers not supported
 };
 ^
/*Store all the custom data of the font*/
static  lv_font_fmt_txt_glyph_cache_t cache;
static const lv_font_fmt_txt_dsc_t font_dsc = {
    .glyph_bitmap = gylph_bitmap,
    .glyph_dsc = glyph_dsc,
    .cmaps = cmaps,
    .kern_dsc = &kern_classes,
    .kern_scale = 16,
    .cmap_num = 2,
    .bpp = 4,
    .kern_classes = 1,
    .bitmap_format = 0,
    .cache = &cache
};


/*-----------------
 *  PUBLIC FONT
 *----------------*/

/*Initialize a public general font descriptor*/
const lv_font_t font_montserrat_alphanum_12 = {
    .get_glyph_dsc = lv_font_get_glyph_dsc_fmt_txt,    /*Function pointer to get glyph's data*/
    .get_glyph_bitmap = lv_font_get_bitmap_fmt_txt,    /*Function pointer to get glyph's bitmap*/
    .line_height = 15,          /*The maximum line height required by the font*/
    .base_line = 3,             /*Baseline measured from the bottom of the line*/
#if !(LVGL_VERSION_MAJOR == 6 && LVGL_VERSION_MINOR == 0)
    .subpx = LV_FONT_SUBPX_NONE,
#endif
#if LV_VERSION_CHECK(7, 4, 0)
    .underline_position = -1,
    .underline_thickness = 1,
#endif
     .dsc = &font_dsc           /*The custom font data. Will be accessed by `get_glyph_bitmap/dsc` */
};

Hi,

Try renaming the file to .c from .cpp

Thanks @kisvegabor, that solved it.

1 Like