#include #include #include #include namespace tt::lvgl { void applyFontSize(settings::display::FontSize fontSize) { LvglFontScale scale; switch (fontSize) { using enum settings::display::FontSize; case Small: scale = FONT_SCALE_SMALL; break; case Large: scale = FONT_SCALE_LARGE; break; case Default: default: scale = FONT_SCALE_DEFAULT; break; } lvgl_set_text_font_scale(scale); const lv_font_t* font = lvgl_get_text_font(FONT_SIZE_DEFAULT); for (lv_display_t* display = lv_display_get_next(nullptr); display != nullptr; display = lv_display_get_next(display)) { #if LV_USE_THEME_DEFAULT if (lv_display_get_theme(display) == lv_theme_default_get()) { lv_obj_t* screen = lv_display_get_screen_active(display); lv_theme_default_init( display, lv_theme_get_color_primary(screen), lv_theme_get_color_secondary(screen), LV_THEME_DEFAULT_DARK, font ); } #endif // The display layers are independent inheritance roots. Updating all of them makes // the new size visible immediately in regular screens, overlays, and the status bar. lv_obj_set_style_text_font(lv_display_get_screen_active(display), font, LV_PART_MAIN); lv_obj_set_style_text_font(lv_display_get_layer_top(display), font, LV_PART_MAIN); lv_obj_set_style_text_font(lv_display_get_layer_sys(display), font, LV_PART_MAIN); lv_obj_set_style_text_font(lv_display_get_layer_bottom(display), font, LV_PART_MAIN); } } } // namespace tt::lvgl