Problem w/ fallback font

Hi,
I’am trying to use fallback font w/ buil-in font to extend extra symbol choice.
I have created a new font w/ FonteAwesome. It works fine when i use it directly w/ lv_obj_set_style_font_text.
In the declaration of the default font of my project (montserrat_12) i added this line :

.dsc = &font_dsc, /*The custom font data. Will be accessed by get_glyph_bitmap/dsc */
.fallback = & cadenas
};

I don’t get compilation error and fallback member of the font montserrat_12 is ok (adress of cadenas font).
But when i add symbol from cadenas fonte in a label text i get only a space caracter…

What’s wrong w/ my code?

Best regards

Hi,

Please attach the fonts and a minimal code to reproduce the issue.

SYMBOLES_XTRA.c (6.3 KB)

Hi,

Well, all my extended symbole fit in the attached fonte.

I created al the define symbol w/ UTF8 bytes

the default font is montserrat_12 and i added this line in the initialization parte of the font struct :

.fallback = &SYMBOLES_XTRA

if i change the font of a label :

lv_obj_set_style_text_font(Cadenas_g,&SYMBOLES_XTRA,0);

lv_label_set_text(Cadenas_g,CADENAS_FERME) ;

i get the right symbol.

but i add the symbol in the text of a label w/ default fontt i get a space :

lv_label_set_text(Label,“Testing Fall back” CADENAS_FERME) ;

Best Regards

What is the value of CADENAS_FERME?

hi

#define CADENAS_FERME “\xEF\x80\xA3”

it’s the caracter w/ ID unicode 0xF023 in the Font Awesome!!

you can see it in the bottom corners of the picture :

It works for me like this:

lv_font_montserrat_12.c:


extern lv_font_t SYMBOLES_XTRA;

/*Initialize a public general font descriptor*/
#if LV_VERSION_CHECK(8, 0, 0)
const lv_font_t lv_font_montserrat_12 = {
#else
lv_font_t lv_font_montserrat_12 = {
#endif
    .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) || LVGL_VERSION_MAJOR >= 8
    .underline_position = -1,
    .underline_thickness = 1,
#endif
    .fallback = &SYMBOLES_XTRA,
    .dsc = &font_dsc           /*The custom font data. Will be accessed by `get_glyph_bitmap/dsc` */
};

main.c

     #define CADENAS_FERME "\xEF\x80\xA3"
     lv_obj_t * label = lv_label_create(lv_scr_act());
     lv_obj_set_style_text_font(label,&lv_font_montserrat_12,0);
     lv_label_set_text(label,"a"CADENAS_FERME"b");

image

Hi…
I’ dont know what was wrong w/ my lvgl’s previous version but w/ the ultimate version (today) it 'all ok!!!
In few week i’ll present my projet w/ arduino due and RA8875 screen.
Best regards

1 Like