LVGL sample code to change font

mediaRif
Posts: 10
Joined: Tue Mar 22, 2022 5:04 am

LVGL sample code to change font

Postby mediaRif » Tue Mar 22, 2022 5:10 am

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).

chegewara
Posts: 2376
Joined: Wed Jun 14, 2017 9:00 pm

Re: LVGL sample code to change font

Postby chegewara » Tue Mar 22, 2022 8:11 pm

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

mediaRif
Posts: 10
Joined: Tue Mar 22, 2022 5:04 am

Re: LVGL sample code to change font

Postby mediaRif » Thu Mar 24, 2022 5:05 pm

Thank you so much!!

Who is online

Users browsing this forum: Google [Bot] and 32 guests