Unable to display Symboles in images

Description

As per the document, I should be able to display text or at least symbols in lv_img_create() but I’m not succeeded anymore to work
(I did succeed in the past, but I totally redesigned my application, upgraded LVGL and it’s not working anymore).

What MCU/Processor/Board and compiler are you using?

ESP-32 (Lyligo Twatch)

What LVGL version are you using?

7.11.0

Code to reproduce

lv_obj_t 	*_obj = lv_img_create( lv_scr_act(), NULL );
lv_obj_align( _obj, NULL, LV_ALIGN_IN_BOTTOM_MID, 0,0 );
lv_img_set_src( _obj, LV_SYMBOL_DUMMY "Test" );
Serial.printf(" Obj : %d,%d %dx%d\n", 
		lv_obj_get_x(_obj), lv_obj_get_y(_obj),
		lv_obj_get_width(_obj), lv_obj_get_height(_obj)
);

If I replace LV_SYMBOL_DUMMY “Test” by a C encoded bitmap image, it’s working.

Thanks

Ok, I found out where my problem was : the container of this image has a style that uses a custom font that doesn’t contains corresponding symbol :no_mouth:
Anyway, as I haven’t explicitly added this style to the image, why does it got it from it’s container ???

(my main concern was to display battery icon, I still duno why LV_SYMBOL_DUMMY above won’t work … probably I mistake of my).

LVGL follows HTML/CSS behavior where child widgets inherit some attributes from their parents. It allows you to do things like set a font on a container and have it apply to all the child widgets, instead of having to add the style to each child widget.

Ha ok, thanks for the explanation.

Hi,

It still not so clear for me :thinking:

  • Image, Label, checkbox … seems inherit from upper container.
  • but it seems it’s not the case for Containers or Button

So what is the rule to apply ?

Thanks