Change font size on v7.10.1 [SOLVED]

Hello all,

I do feel kind of stupid for having to ask, but it seems I’m not able to do something as trivial as changing the font size on a label.

What I tried:

  • Enable the appropriate fonts in my lv_conf.h
  • Create a style, set the text font
  • Apply the style to a label.

Here is my code:

lv_style_t style;                                             
lv_style_init(&style);
lv_style_set_text_font(&style, LV_STATE_DEFAULT, &lv_font_montserrat_28);
        
lv_obj_t *ta1 = lv_label_create(screen_uart, NULL);
lv_obj_add_style(ta1, LV_OBJ_PART_MAIN, &style);
lv_label_set_text(ta1, "A text in a\nText\nArea");

The end result is not what I expect it to be: the label is always shown in the exact same font that is specified in the theme (material)

I guess I have a wrong undestanding of cascading/overriding of styles?

Right, got it by enabling LV_USE_ASSERT_MEM_INTEGRITY, and indeed it was stupid: The scope of the style was not static, so the life time was limited to the function call where the style was initialized.