Skip to content

Commit 1cf1b24

Browse files
committed
feat(theme_mono): Pass small/large fonts to theme init
In order to allow setting the small/large fonts, pass them to the mono theme initialization function. Signed-off-by: Peter Johanson <peter@peterjohanson.com>
1 parent 85aa60d commit 1cf1b24

3 files changed

Lines changed: 6 additions & 6 deletions

File tree

src/display/lv_display.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,7 @@ lv_display_t * lv_display_create(int32_t hor_res, int32_t ver_res)
144144
}
145145
#elif LV_USE_THEME_MONO
146146
if(lv_theme_mono_is_inited() == false) {
147-
disp->theme = lv_theme_mono_init(disp, false, LV_FONT_DEFAULT);
147+
disp->theme = lv_theme_mono_init(disp, false, LV_FONT_DEFAULT, LV_FONT_DEFAULT, LV_FONT_DEFAULT);
148148
}
149149
else {
150150
disp->theme = lv_theme_mono_get();

src/themes/mono/lv_theme_mono.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -181,7 +181,7 @@ static void style_init(my_theme_t * theme, bool dark_bg, const lv_font_t * font)
181181
* GLOBAL FUNCTIONS
182182
**********************/
183183

184-
lv_theme_t * lv_theme_mono_init(lv_display_t * disp, bool dark_bg, const lv_font_t * font)
184+
lv_theme_t * lv_theme_mono_init(lv_display_t * disp, bool dark_bg, const lv_font_t * font, const lv_font_t * small_font, const lv_font_t * large_font)
185185
{
186186
/*This trick is required only to avoid the garbage collection of
187187
*styles' data if LVGL is used in a binding (e.g. MicroPython)
@@ -194,9 +194,9 @@ lv_theme_t * lv_theme_mono_init(lv_display_t * disp, bool dark_bg, const lv_font
194194
my_theme_t * theme = theme_def;
195195

196196
theme->base.disp = disp;
197-
theme->base.font_small = LV_FONT_DEFAULT;
198-
theme->base.font_normal = LV_FONT_DEFAULT;
199-
theme->base.font_large = LV_FONT_DEFAULT;
197+
theme->base.font_small = small_font;
198+
theme->base.font_normal = font;
199+
theme->base.font_large = large_font;
200200
theme->base.apply_cb = theme_apply;
201201
#if LV_USE_EXT_DATA
202202
theme->base.ext_data.free_cb = NULL;

src/themes/mono/lv_theme_mono.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ extern "C" {
3636
* @param font pointer to a font to use.
3737
* @return a pointer to reference this theme later
3838
*/
39-
lv_theme_t * lv_theme_mono_init(lv_display_t * disp, bool dark_bg, const lv_font_t * font);
39+
lv_theme_t * lv_theme_mono_init(lv_display_t * disp, bool dark_bg, const lv_font_t * font, const lv_font_t * small_font, const lv_font_t * large_font);
4040

4141
/**
4242
* Check if the theme is initialized

0 commit comments

Comments
 (0)