Page 1 of 1

LVGL sample code to change font

Posted: Tue Mar 22, 2022 5:10 am
by mediaRif
I'm hoping somebody can post a very simple example of how to change the font size in the ESP32 port of the LVGL library (LVGL V8).

Re: LVGL sample code to change font

Posted: Tue Mar 22, 2022 8:11 pm
by chegewara

Code: Select all

    static lv_style_t style;
    lv_style_init(&style);
    lv_style_set_text_font(&style, &lv_font_montserrat_10); // <--- you have to enable other font sizes in menuconfig
    lv_obj_add_style(obj, &style, 0);  // <--- obj is the label

Re: LVGL sample code to change font

Posted: Thu Mar 24, 2022 5:05 pm
by mediaRif
Thank you so much!!