More flexible font defines

This commit is contained in:
fvanroie 2021-02-04 18:30:19 +01:00
parent c8cbaa27f7
commit fd7335485b
2 changed files with 18 additions and 24 deletions

View File

@ -377,10 +377,16 @@ typedef void* lv_font_user_data_t;
/*Always set a default font from the built-in fonts*/
#if LV_HIGH_RESOURCE_MCU>0
// #define LV_FONT_CUSTOM_DECLARE LV_FONT_DECLARE(lv_font_montserrat_16);
#define LV_FONT_CUSTOM_DECLARE LV_FONT_DECLARE(robotocondensed_regular_12_nokern) \
LV_FONT_DECLARE(robotocondensed_regular_22_nokern) \
LV_FONT_DECLARE(robotocondensed_regular_16_nokern) \
LV_FONT_DECLARE(robotocondensed_regular_28_nokern) \
#define LV_FONT_CUSTOM_12 LV_FONT_DECLARE(robotocondensed_regular_12_nokern)
#define LV_FONT_CUSTOM_16 LV_FONT_DECLARE(robotocondensed_regular_16_nokern)
#define LV_FONT_CUSTOM_22 LV_FONT_DECLARE(robotocondensed_regular_22_nokern)
#define LV_FONT_CUSTOM_28 LV_FONT_DECLARE(robotocondensed_regular_28_nokern)
#define LV_FONT_CUSTOM_DECLARE LV_FONT_CUSTOM_12 \
LV_FONT_CUSTOM_16 \
LV_FONT_CUSTOM_22 \
LV_FONT_CUSTOM_28 \
#define LV_FONT_DEFAULT &robotocondensed_regular_16_nokern //&lv_font_montserrat_16
#else

View File

@ -636,36 +636,24 @@ static lv_font_t * haspPayloadToFont(const char * payload)
#if ESP32
#if LV_FONT_MONTSERRAT_12 > 0
#ifdef LV_FONT_CUSTOM_12
case 12:
return &lv_font_montserrat_12;
#else
case 12:
return &robotocondensed_regular_12_nokern;
return LV_THEME_DEFAULT_FONT_SMALL;
#endif
#if LV_FONT_MONTSERRAT_16 > 0
#ifdef LV_FONT_CUSTOM_16
case 16:
return &lv_font_montserrat_16;
#else
case 16:
return &robotocondensed_regular_16_nokern;
return LV_THEME_DEFAULT_FONT_NORMAL;
#endif
#if LV_FONT_MONTSERRAT_22 > 0
#ifdef LV_FONT_CUSTOM_22
case 22:
return &lv_font_montserrat_22;
#else
case 22:
return &robotocondensed_regular_22_nokern;
return LV_THEME_DEFAULT_FONT_SUBTITLE;
#endif
#if LV_FONT_MONTSERRAT_28 > 0
#ifdef LV_FONT_CUSTOM_28
case 28:
return &lv_font_montserrat_28_compressed;
#else
case 28:
return &robotocondensed_regular_28_nokern;
return LV_THEME_DEFAULT_FONT_TITLE;
#endif
#endif