Description
I use the LV_USE_THEME_MATERIAL theme, and set the font configuration in the configuration file lv_conf.h as follows:
#define LV_THEME_DEFAULT_INCLUDE <stdint.h> /Include a header for the init. function/
#define LV_THEME_DEFAULT_INIT lv_theme_material_init
#define LV_THEME_DEFAULT_COLOR_PRIMARY LV_COLOR_RED
#define LV_THEME_DEFAULT_COLOR_SECONDARY LV_COLOR_BLUE
#define LV_THEME_DEFAULT_FLAG LV_THEME_MATERIAL_FLAG_LIGHT
#define LV_THEME_DEFAULT_FONT_SMALL &lv_font_montserrat_22
#define LV_THEME_DEFAULT_FONT_NORMAL &lv_font_montserrat_24
#define LV_THEME_DEFAULT_FONT_SUBTITLE &lv_font_montserrat_26
#define LV_THEME_DEFAULT_FONT_TITLE &lv_font_montserrat_32
But when I run the program, all the fonts I use become the same size. such as lv_font_montserrat_32;
What MCU/Processor/Board and compiler are you using?
Arm
What LVGL version are you using?
V7.0
What do you want to achieve?
Apply different size font in theme.
What have you tried so far?
Code to reproduce
This is my code to set the label style:
// style
lv_style_init(&style_home_time_label);
lv_style_set_text_color(&style_home_time_label, LV_STATE_DEFAULT, GUI_APP_WHITE);
lv_style_set_bg_opa(&style_home_time_label, LV_STATE_DEFAULT, LV_OPA_1);
lv_style_set_value_font(&style_home_time_label, LV_STATE_DEFAULT, lv_theme_get_font_title());
lv_obj_t * label = lv_label_create(img, NULL);
lv_label_set_text(label, " 01:45\n");
lv_obj_add_style(label, LV_OBJ_PART_MAIN, &style_home_time_label);
lv_obj_set_pos(label, 27, 32);
lv_obj_set_size(label, 124, 70);