From dd9324ac05b826aa2bdc84758280149d4e120be9 Mon Sep 17 00:00:00 2001 From: Gabor Kiss-Vamosi Date: Sat, 7 Jul 2018 11:26:24 +0200 Subject: [PATCH] lv_conf.h: add LV_FONT_CUSTOM_DECLARE to enable global defination of custom fonts --- lv_conf_templ.h | 12 ++++++++++-- lv_misc/lv_font.h | 9 ++++++--- 2 files changed, 16 insertions(+), 5 deletions(-) diff --git a/lv_conf_templ.h b/lv_conf_templ.h index df3848e16c..7b9a43abd5 100644 --- a/lv_conf_templ.h +++ b/lv_conf_templ.h @@ -104,8 +104,6 @@ /* More info about fonts: https://littlevgl.com/basics#fonts * To enable a built-in font use 1,2,4 or 8 values * which will determine the bit-per-pixel */ -#define LV_FONT_DEFAULT &lv_font_dejavu_20 /*Always set a default font from the built-in fonts*/ - #define USE_LV_FONT_DEJAVU_10 0 #define USE_LV_FONT_DEJAVU_10_LATIN_SUP 0 #define USE_LV_FONT_DEJAVU_10_CYRILLIC 0 @@ -126,6 +124,16 @@ #define USE_LV_FONT_DEJAVU_40_CYRILLIC 0 #define USE_LV_FONT_SYMBOL_40 0 +/* Optionally declare your custom fonts here. + * You can use these fonts as defult font too + * and they will be avialale globally. E.g. + * #define LV_FONT_CUSTOM_DECLARE LV_FONT_DECLARE(my_font_1) \ + * LV_FONT_DECLARE(my_font_2) \ + */ +#define LV_FONT_CUSTOM_DECLARE + +#define LV_FONT_DEFAULT &lv_font_dejavu_20 /*Always set a default font from the built-in fonts*/ + /*=================== * LV_OBJ SETTINGS *==================*/ diff --git a/lv_misc/lv_font.h b/lv_misc/lv_font.h index 8941146152..6465c46565 100644 --- a/lv_misc/lv_font.h +++ b/lv_misc/lv_font.h @@ -141,9 +141,9 @@ int16_t lv_font_get_width_sparse(const lv_font_t * font, uint32_t unicode_letter **********************/ #define LV_FONT_DECLARE(font_name) extern lv_font_t font_name; -/****************************** - * FONT DECLARATION INCLUDES - *****************************/ +/********************** + * FONT DECLARATION + **********************/ /*10 px */ #if USE_LV_FONT_DEJAVU_10 @@ -213,6 +213,9 @@ LV_FONT_DECLARE(lv_font_dejavu_40_cyrillic); LV_FONT_DECLARE(lv_font_symbol_40); #endif +/*Declare the custom (user defined) fonts*/ +LV_FONT_CUSTOM_DECLARE + #ifdef __cplusplus } /* extern "C" */ #endif