How to properly use the default fonts in LVGL


What is the easiest way to use one of the default fonts ?

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

Windows Simulator

What LVGL version are you using?


What do you want to achieve?

Use a bigger font size for some labels

What have you tried so far?

1- enabling bigger fonts in lv_conf.h
2-creating a style and assigning a bigger font to it.
3-assigning the style to a label.

Code to reproduce

Add a code snippet which can run in the simulator. It should contain only the relevant code that compiles without errors when separated from your main code base.
The code block(s) should be formatted like:

static lv_style_t * style;
static const lv_font_t * font;

void main(void)

    font = &lv_font_montserrat_40;

    lv_style_set_text_font(&style, font);
    lv_style_set_text_color(&style, lv_color_black());

    lv_label_t * test_label = lv_label_create(lv_scr_act());
    lv_label_set_text(test_label, "Hello World");
    lv_obj_align(test_label, LV_ALIGN_CENTER, 0, 0);
    lv_obj_add_style(test_label, &style, 0);


Screenshot and/or video

If possible, add screenshots and/or videos about the current state.


I’ve finally got it working.
Not sure exactly why, but I think using variable\pointer name “style” wasn’t good practice. Changing the declaration name of the new style from “style” to “style_title” resolved my issue.