From 445446111b7479a906f4860120c8a56e4aac0e63 Mon Sep 17 00:00:00 2001 From: fvanroie Date: Fri, 20 Jan 2023 18:54:35 +0100 Subject: [PATCH] Include bitmap fonts in 12, 16, 24 & 32pt sizes --- include/lv_conf_v7.h | 513 +++++++++++++++++++++++-------------------- src/hasp/hasp.cpp | 36 +-- 2 files changed, 278 insertions(+), 271 deletions(-) diff --git a/include/lv_conf_v7.h b/include/lv_conf_v7.h index 72e523b9..faa665e1 100644 --- a/include/lv_conf_v7.h +++ b/include/lv_conf_v7.h @@ -376,226 +376,265 @@ typedef void* lv_indev_drv_user_data_t; /*Type of user data in the in /*================== * FONT USAGE *===================*/ -#if 1 || HASP_USE_FREETYPE<=0 - #if TFT_HEIGHT>=480 && TFT_WIDTH>=480 - #ifndef ROBOTOCONDENSED_REGULAR_24_LATIN1 - #define ROBOTOCONDENSED_REGULAR_24_LATIN1 1 - #endif - #ifndef ROBOTOCONDENSED_REGULAR_32_LATIN1 - #define ROBOTOCONDENSED_REGULAR_32_LATIN1 1 - #endif - #if HASP_USE_FREETYPE<=0 - #ifndef ROBOTOCONDENSED_REGULAR_48_LATIN1 - #define ROBOTOCONDENSED_REGULAR_48_LATIN1 1 - #endif - #ifndef ROBOTOCONDENSED_REGULAR_64_LATIN1 - #define ROBOTOCONDENSED_REGULAR_64_LATIN1 1 - #endif - #ifndef ROBOTOCONDENSED_REGULAR_16_LATIN1 - #define ROBOTOCONDENSED_REGULAR_16_LATIN1 1 - #endif - #endif +// #if 1 || HASP_USE_FREETYPE<=0 +// #if TFT_HEIGHT>=480 && TFT_WIDTH>=480 +// #ifndef ROBOTOCONDENSED_REGULAR_24_LATIN1 +// #define ROBOTOCONDENSED_REGULAR_24_LATIN1 1 +// #endif +// #ifndef ROBOTOCONDENSED_REGULAR_32_LATIN1 +// #define ROBOTOCONDENSED_REGULAR_32_LATIN1 1 +// #endif +// #if HASP_USE_FREETYPE<=0 +// #ifndef ROBOTOCONDENSED_REGULAR_48_LATIN1 +// #define ROBOTOCONDENSED_REGULAR_48_LATIN1 1 +// #endif +// #ifndef ROBOTOCONDENSED_REGULAR_64_LATIN1 +// #define ROBOTOCONDENSED_REGULAR_64_LATIN1 1 +// #endif +// #ifndef ROBOTOCONDENSED_REGULAR_16_LATIN1 +// #define ROBOTOCONDENSED_REGULAR_16_LATIN1 1 +// #endif +// #endif - #ifndef HASP_FONT_1 - #define HASP_FONT_1 robotocondensed_regular_24_latin1 /* 5% Width */ - #endif - #ifndef HASP_FONT_2 - #define HASP_FONT_2 robotocondensed_regular_32_latin1 /* 5% Width */ - #endif - #if HASP_USE_FREETYPE<=0 - #ifndef HASP_FONT_3 - #define HASP_FONT_3 robotocondensed_regular_48_latin1 /* 10% Width */ - #endif - #ifndef HASP_FONT_4 - #define HASP_FONT_4 robotocondensed_regular_64_latin1 /* 10% Height */ - #endif - #ifndef HASP_FONT_5 - #define HASP_FONT_5 robotocondensed_regular_16_latin1 /* 5% Width */ - #endif - #endif +// #ifndef HASP_FONT_1 +// #define HASP_FONT_1 robotocondensed_regular_24_latin1 /* 5% Width */ +// #endif +// #ifndef HASP_FONT_2 +// #define HASP_FONT_2 robotocondensed_regular_32_latin1 /* 5% Width */ +// #endif +// #if HASP_USE_FREETYPE<=0 +// #ifndef HASP_FONT_3 +// #define HASP_FONT_3 robotocondensed_regular_48_latin1 /* 10% Width */ +// #endif +// #ifndef HASP_FONT_4 +// #define HASP_FONT_4 robotocondensed_regular_64_latin1 /* 10% Height */ +// #endif +// #ifndef HASP_FONT_5 +// #define HASP_FONT_5 robotocondensed_regular_16_latin1 /* 5% Width */ +// #endif +// #endif - #ifndef HASP_FONT_SIZE_1 - #define HASP_FONT_SIZE_1 24 - #endif - #ifndef HASP_FONT_SIZE_2 - #define HASP_FONT_SIZE_2 32 - #endif - #if HASP_USE_FREETYPE<=0 - #ifndef HASP_FONT_SIZE_3 - #define HASP_FONT_SIZE_3 48 - #endif - #ifndef HASP_FONT_SIZE_4 - #define HASP_FONT_SIZE_4 64 - #endif - #ifndef HASP_FONT_SIZE_5 - #define HASP_FONT_SIZE_5 16 - #endif - #endif +// #ifndef HASP_FONT_SIZE_1 +// #define HASP_FONT_SIZE_1 24 +// #endif +// #ifndef HASP_FONT_SIZE_2 +// #define HASP_FONT_SIZE_2 32 +// #endif +// #if HASP_USE_FREETYPE<=0 +// #ifndef HASP_FONT_SIZE_3 +// #define HASP_FONT_SIZE_3 48 +// #endif +// #ifndef HASP_FONT_SIZE_4 +// #define HASP_FONT_SIZE_4 64 +// #endif +// #ifndef HASP_FONT_SIZE_5 +// #define HASP_FONT_SIZE_5 16 +// #endif +// #endif - #elif TFT_HEIGHT>=320 && TFT_WIDTH>=320 - #ifndef ROBOTOCONDENSED_REGULAR_16_LATIN1 - #define ROBOTOCONDENSED_REGULAR_16_LATIN1 1 - #endif - #ifndef ROBOTOCONDENSED_REGULAR_24_LATIN1 - #define ROBOTOCONDENSED_REGULAR_24_LATIN1 1 - #endif - #if HASP_USE_FREETYPE<=0 - #ifndef ROBOTOCONDENSED_REGULAR_32_LATIN1 - #define ROBOTOCONDENSED_REGULAR_32_LATIN1 1 - #endif - #ifndef ROBOTOCONDENSED_REGULAR_48_LATIN1 - #define ROBOTOCONDENSED_REGULAR_48_LATIN1 1 - #endif - #ifndef ROBOTOCONDENSED_REGULAR_12_LATIN1 - #define ROBOTOCONDENSED_REGULAR_12_LATIN1 1 - #endif - #endif +// #elif TFT_HEIGHT>=320 && TFT_WIDTH>=320 +// #ifndef ROBOTOCONDENSED_REGULAR_16_LATIN1 +// #define ROBOTOCONDENSED_REGULAR_16_LATIN1 1 +// #endif +// #ifndef ROBOTOCONDENSED_REGULAR_24_LATIN1 +// #define ROBOTOCONDENSED_REGULAR_24_LATIN1 1 +// #endif +// #if HASP_USE_FREETYPE<=0 +// #ifndef ROBOTOCONDENSED_REGULAR_32_LATIN1 +// #define ROBOTOCONDENSED_REGULAR_32_LATIN1 1 +// #endif +// #ifndef ROBOTOCONDENSED_REGULAR_48_LATIN1 +// #define ROBOTOCONDENSED_REGULAR_48_LATIN1 1 +// #endif +// #ifndef ROBOTOCONDENSED_REGULAR_12_LATIN1 +// #define ROBOTOCONDENSED_REGULAR_12_LATIN1 1 +// #endif +// #endif - #ifndef HASP_FONT_1 - #define HASP_FONT_1 robotocondensed_regular_16_latin1 /* 5% Width */ - #endif - #ifndef HASP_FONT_2 - #define HASP_FONT_2 robotocondensed_regular_24_latin1 /* 5% Width */ - #endif - #if HASP_USE_FREETYPE<=0 - #ifndef HASP_FONT_3 - #define HASP_FONT_3 robotocondensed_regular_32_latin1 /* 10% Width */ - #endif - #ifndef HASP_FONT_4 - #define HASP_FONT_4 robotocondensed_regular_48_latin1 /* 10% Height */ - #endif - #ifndef HASP_FONT_5 - #define HASP_FONT_5 robotocondensed_regular_12_latin1 /* 5% Width */ - #endif - #endif +// #ifndef HASP_FONT_1 +// #define HASP_FONT_1 robotocondensed_regular_16_latin1 /* 5% Width */ +// #endif +// #ifndef HASP_FONT_2 +// #define HASP_FONT_2 robotocondensed_regular_24_latin1 /* 5% Width */ +// #endif +// #if HASP_USE_FREETYPE<=0 +// #ifndef HASP_FONT_3 +// #define HASP_FONT_3 robotocondensed_regular_32_latin1 /* 10% Width */ +// #endif +// #ifndef HASP_FONT_4 +// #define HASP_FONT_4 robotocondensed_regular_48_latin1 /* 10% Height */ +// #endif +// #ifndef HASP_FONT_5 +// #define HASP_FONT_5 robotocondensed_regular_12_latin1 /* 5% Width */ +// #endif +// #endif - #ifndef HASP_FONT_SIZE_1 - #define HASP_FONT_SIZE_1 16 - #endif - #ifndef HASP_FONT_SIZE_2 - #define HASP_FONT_SIZE_2 24 - #endif - #if HASP_USE_FREETYPE<=0 - #ifndef HASP_FONT_SIZE_3 - #define HASP_FONT_SIZE_3 32 - #endif - #ifndef HASP_FONT_SIZE_4 - #define HASP_FONT_SIZE_4 48 - #endif - #ifndef HASP_FONT_SIZE_5 - #define HASP_FONT_SIZE_5 12 - #endif - #endif +// #ifndef HASP_FONT_SIZE_1 +// #define HASP_FONT_SIZE_1 16 +// #endif +// #ifndef HASP_FONT_SIZE_2 +// #define HASP_FONT_SIZE_2 24 +// #endif +// #if HASP_USE_FREETYPE<=0 +// #ifndef HASP_FONT_SIZE_3 +// #define HASP_FONT_SIZE_3 32 +// #endif +// #ifndef HASP_FONT_SIZE_4 +// #define HASP_FONT_SIZE_4 48 +// #endif +// #ifndef HASP_FONT_SIZE_5 +// #define HASP_FONT_SIZE_5 12 +// #endif +// #endif - #elif TFT_HEIGHT>=272 && TFT_WIDTH>=272 - #ifndef ROBOTOCONDENSED_REGULAR_14_LATIN1 - #define ROBOTOCONDENSED_REGULAR_14_LATIN1 1 - #endif - #ifndef ROBOTOCONDENSED_REGULAR_18_LATIN1 - #define ROBOTOCONDENSED_REGULAR_18_LATIN1 1 - #endif - #if HASP_USE_FREETYPE<=0 - #ifndef ROBOTOCONDENSED_REGULAR_28_LATIN1 - #define ROBOTOCONDENSED_REGULAR_28_LATIN1 1 - #endif - #ifndef ROBOTOCONDENSED_REGULAR_36_LATIN1 - #define ROBOTOCONDENSED_REGULAR_36_LATIN1 1 - #endif - #ifndef ROBOTOCONDENSED_REGULAR_48_LATIN1 - #define ROBOTOCONDENSED_REGULAR_48_LATIN1 1 - #endif - #endif +// #elif TFT_HEIGHT>=272 && TFT_WIDTH>=272 +// #ifndef ROBOTOCONDENSED_REGULAR_14_LATIN1 +// #define ROBOTOCONDENSED_REGULAR_14_LATIN1 1 +// #endif +// #ifndef ROBOTOCONDENSED_REGULAR_18_LATIN1 +// #define ROBOTOCONDENSED_REGULAR_18_LATIN1 1 +// #endif +// #if HASP_USE_FREETYPE<=0 +// #ifndef ROBOTOCONDENSED_REGULAR_28_LATIN1 +// #define ROBOTOCONDENSED_REGULAR_28_LATIN1 1 +// #endif +// #ifndef ROBOTOCONDENSED_REGULAR_36_LATIN1 +// #define ROBOTOCONDENSED_REGULAR_36_LATIN1 1 +// #endif +// #ifndef ROBOTOCONDENSED_REGULAR_48_LATIN1 +// #define ROBOTOCONDENSED_REGULAR_48_LATIN1 1 +// #endif +// #endif - #ifndef HASP_FONT_1 - #define HASP_FONT_1 robotocondensed_regular_14_latin1 /* 5% Width */ - #endif - #ifndef HASP_FONT_2 - #define HASP_FONT_2 robotocondensed_regular_18_latin1 /* 5% Width */ - #endif - #if HASP_USE_FREETYPE<=0 - #ifndef HASP_FONT_3 - #define HASP_FONT_3 robotocondensed_regular_28_latin1 /* 10% Width */ - #endif - #ifndef HASP_FONT_4 - #define HASP_FONT_4 robotocondensed_regular_36_latin1 /* 10% Height */ - #endif - #ifndef HASP_FONT_5 - #define HASP_FONT_5 robotocondensed_regular_48_latin1 /* 5% Width */ - #endif - #endif +// #ifndef HASP_FONT_1 +// #define HASP_FONT_1 robotocondensed_regular_14_latin1 /* 5% Width */ +// #endif +// #ifndef HASP_FONT_2 +// #define HASP_FONT_2 robotocondensed_regular_18_latin1 /* 5% Width */ +// #endif +// #if HASP_USE_FREETYPE<=0 +// #ifndef HASP_FONT_3 +// #define HASP_FONT_3 robotocondensed_regular_28_latin1 /* 10% Width */ +// #endif +// #ifndef HASP_FONT_4 +// #define HASP_FONT_4 robotocondensed_regular_36_latin1 /* 10% Height */ +// #endif +// #ifndef HASP_FONT_5 +// #define HASP_FONT_5 robotocondensed_regular_48_latin1 /* 5% Width */ +// #endif +// #endif - #ifndef HASP_FONT_SIZE_1 - #define HASP_FONT_SIZE_1 14 - #endif - #ifndef HASP_FONT_SIZE_2 - #define HASP_FONT_SIZE_2 18 - #endif - #if HASP_USE_FREETYPE<=0 - #ifndef HASP_FONT_SIZE_3 - #define HASP_FONT_SIZE_3 28 - #endif - #ifndef HASP_FONT_SIZE_4 - #define HASP_FONT_SIZE_4 36 - #endif - #ifndef HASP_FONT_SIZE_5 - #define HASP_FONT_SIZE_5 48 - #endif - #endif +// #ifndef HASP_FONT_SIZE_1 +// #define HASP_FONT_SIZE_1 14 +// #endif +// #ifndef HASP_FONT_SIZE_2 +// #define HASP_FONT_SIZE_2 18 +// #endif +// #if HASP_USE_FREETYPE<=0 +// #ifndef HASP_FONT_SIZE_3 +// #define HASP_FONT_SIZE_3 28 +// #endif +// #ifndef HASP_FONT_SIZE_4 +// #define HASP_FONT_SIZE_4 36 +// #endif +// #ifndef HASP_FONT_SIZE_5 +// #define HASP_FONT_SIZE_5 48 +// #endif +// #endif - #else // smaller than 272 +// #else // smaller than 272 - #ifndef HASP_FONT_1 - #define HASP_FONT_1 robotocondensed_regular_12_latin1 /* 5% Width */ - #endif - #ifndef HASP_FONT_2 - #define HASP_FONT_2 robotocondensed_regular_16_latin1 /* 5% Width */ - #endif - #if HASP_USE_FREETYPE<=0 - #ifndef HASP_FONT_3 - #define HASP_FONT_3 robotocondensed_regular_24_latin1 /* 10% Width */ - #endif - #ifndef HASP_FONT_4 - #define HASP_FONT_4 robotocondensed_regular_32_latin1 /* 10% Height */ - #endif - #endif +// #ifndef HASP_FONT_1 +// #define HASP_FONT_1 robotocondensed_regular_12_latin1 /* 5% Width */ +// #endif +// #ifndef HASP_FONT_2 +// #define HASP_FONT_2 robotocondensed_regular_16_latin1 /* 5% Width */ +// #endif +// #if HASP_USE_FREETYPE<=0 +// #ifndef HASP_FONT_3 +// #define HASP_FONT_3 robotocondensed_regular_24_latin1 /* 10% Width */ +// #endif +// #ifndef HASP_FONT_4 +// #define HASP_FONT_4 robotocondensed_regular_32_latin1 /* 10% Height */ +// #endif +// #endif - #ifndef ROBOTOCONDENSED_REGULAR_12_LATIN1 - #define ROBOTOCONDENSED_REGULAR_12_LATIN1 1 - #endif - #ifndef ROBOTOCONDENSED_REGULAR_16_LATIN1 - #define ROBOTOCONDENSED_REGULAR_16_LATIN1 1 - #endif - #if HASP_USE_FREETYPE<=0 - #ifndef ROBOTOCONDENSED_REGULAR_24_LATIN1 - #define ROBOTOCONDENSED_REGULAR_24_LATIN1 1 - #endif - #ifndef ROBOTOCONDENSED_REGULAR_32_LATIN1 - #define ROBOTOCONDENSED_REGULAR_32_LATIN1 1 - #endif - #ifndef ROBOTOCONDENSED_REGULAR_48_LATIN1 - #define ROBOTOCONDENSED_REGULAR_48_LATIN1 1 - #endif - #endif +// #ifndef ROBOTOCONDENSED_REGULAR_12_LATIN1 +// #define ROBOTOCONDENSED_REGULAR_12_LATIN1 1 +// #endif +// #ifndef ROBOTOCONDENSED_REGULAR_16_LATIN1 +// #define ROBOTOCONDENSED_REGULAR_16_LATIN1 1 +// #endif +// #if HASP_USE_FREETYPE<=0 +// #ifndef ROBOTOCONDENSED_REGULAR_24_LATIN1 +// #define ROBOTOCONDENSED_REGULAR_24_LATIN1 1 +// #endif +// #ifndef ROBOTOCONDENSED_REGULAR_32_LATIN1 +// #define ROBOTOCONDENSED_REGULAR_32_LATIN1 1 +// #endif +// #ifndef ROBOTOCONDENSED_REGULAR_48_LATIN1 +// #define ROBOTOCONDENSED_REGULAR_48_LATIN1 1 +// #endif +// #endif - #ifndef HASP_FONT_SIZE_1 - #define HASP_FONT_SIZE_1 12 - #endif - #ifndef HASP_FONT_SIZE_2 - #define HASP_FONT_SIZE_2 16 - #endif - #if HASP_USE_FREETYPE<=0 - #ifndef HASP_FONT_SIZE_3 - #define HASP_FONT_SIZE_3 24 - #endif - #ifndef HASP_FONT_SIZE_4 - #define HASP_FONT_SIZE_4 32 - #endif - #ifndef HASP_FONT_SIZE_5 - #define HASP_FONT_SIZE_5 48 - #endif - #endif +// #ifndef HASP_FONT_SIZE_1 +// #define HASP_FONT_SIZE_1 12 +// #endif +// #ifndef HASP_FONT_SIZE_2 +// #define HASP_FONT_SIZE_2 16 +// #endif +// #if HASP_USE_FREETYPE<=0 +// #ifndef HASP_FONT_SIZE_3 +// #define HASP_FONT_SIZE_3 24 +// #endif +// #ifndef HASP_FONT_SIZE_4 +// #define HASP_FONT_SIZE_4 32 +// #endif +// #ifndef HASP_FONT_SIZE_5 +// #define HASP_FONT_SIZE_5 48 +// #endif +// #endif - #endif +// #endif +// #endif + +#ifndef ROBOTOCONDENSED_REGULAR_12_ALL +#define ROBOTOCONDENSED_REGULAR_12_ALL 1 +#endif +#ifndef ROBOTOCONDENSED_REGULAR_16_ALL +#define ROBOTOCONDENSED_REGULAR_16_ALL 1 +#endif +#ifndef ROBOTOCONDENSED_REGULAR_24_ALL +#define ROBOTOCONDENSED_REGULAR_24_ALL 1 +#endif +#ifndef ROBOTOCONDENSED_REGULAR_32_ALL +#define ROBOTOCONDENSED_REGULAR_32_ALL 1 +#endif + +#ifndef HASP_FONT_1 +#define HASP_FONT_1 robotocondensed_regular_12_all +#endif +#ifndef HASP_FONT_2 +#define HASP_FONT_2 robotocondensed_regular_16_all +#endif +#ifndef HASP_FONT_3 +#define HASP_FONT_3 robotocondensed_regular_24_all +#endif +#ifndef HASP_FONT_4 +#define HASP_FONT_4 robotocondensed_regular_32_all +#endif + +#ifndef HASP_FONT_SIZE_1 +#define HASP_FONT_SIZE_1 12 +#endif +#ifndef HASP_FONT_SIZE_2 +#define HASP_FONT_SIZE_2 16 +#endif +#ifndef HASP_FONT_SIZE_3 +#define HASP_FONT_SIZE_3 24 +#endif +#ifndef HASP_FONT_SIZE_4 +#define HASP_FONT_SIZE_4 32 #endif /* The built-in fonts contains the ASCII range and some Symbols with 4 bit-per-pixel. @@ -683,30 +722,11 @@ typedef void* lv_font_user_data_t; // #define HASP_FONT_1_base FONT_CONCAT(HASP_FONT_1_size, _) // #define HASP_FONT_1 FONT_CONCAT(HASP_FONT_1_base, HASP_CHARACTER_SET) -// /* Concatenate the fontname macros */ -// #define HASP_FONT_2_size FONT_CONCAT(HASP_FONTNAME, 16) -// #define HASP_FONT_2_base FONT_CONCAT(HASP_FONT_2_size, _) -// #define HASP_FONT_2 FONT_CONCAT(HASP_FONT_2_base, HASP_CHARACTER_SET) - -// /* Concatenate the fontname macros */ -// #define HASP_FONT_3_size FONT_CONCAT(HASP_FONTNAME, 22) -// #define HASP_FONT_3_base FONT_CONCAT(HASP_FONT_3_size, _) -// #define HASP_FONT_3 FONT_CONCAT(HASP_FONT_3_base, HASP_CHARACTER_SET) - -// /* Concatenate the fontname macros */ -// #define HASP_FONT_4_size FONT_CONCAT(HASP_FONTNAME, 28) -// #define HASP_FONT_4_base FONT_CONCAT(HASP_FONT_4_size, _) -// #define HASP_FONT_4 FONT_CONCAT(HASP_FONT_4_base, HASP_CHARACTER_SET) /*Always set a default font from the built-in fonts*/ -#if HASP_USE_FREETYPE<=0 // LV_HIGH_RESOURCE_MCU>0 +#if 0 && HASP_USE_FREETYPE<=0 // LV_HIGH_RESOURCE_MCU>0 // #define LV_FONT_CUSTOM_DECLARE LV_FONT_DECLARE(lv_font_montserrat_16); -// #define LV_FONT_CUSTOM_12 LV_FONT_DECLARE(robotocondensed_regular_12) -// #define LV_FONT_CUSTOM_16 LV_FONT_DECLARE(robotocondensed_regular_16) -// #define LV_FONT_CUSTOM_22 LV_FONT_DECLARE(robotocondensed_regular_22) -// #define LV_FONT_CUSTOM_28 LV_FONT_DECLARE(robotocondensed_regular_28) - #define LV_FONT_CUSTOM_DECLARE LV_FONT_DECLARE(HASP_FONT_1) \ LV_FONT_DECLARE(HASP_FONT_2) \ LV_FONT_DECLARE(HASP_FONT_3) \ @@ -722,10 +742,25 @@ typedef void* lv_font_user_data_t; //#define LV_FONT_CUSTOM_DECLARE LV_FONT_DECLARE(unscii_8_icon); #define LV_FONT_CUSTOM_DECLARE LV_FONT_DECLARE(HASP_FONT_1) \ LV_FONT_DECLARE(HASP_FONT_2) \ + LV_FONT_DECLARE(HASP_FONT_3) \ + LV_FONT_DECLARE(HASP_FONT_4) \ #ifndef LV_FONT_DEFAULT -#define LV_FONT_DEFAULT &HASP_FONT_2 //&lv_font_unscii_8 +#if TFT_HEIGHT >= 480 && TFT_WIDTH >= 480 + #define LV_FONT_DEFAULT &HASP_FONT_4 + #define LV_THEME_DEFAULT_FONT_SMALL &HASP_FONT_3 +#elif TFT_HEIGHT >= 320 && TFT_WIDTH >= 320 + #define LV_FONT_DEFAULT &HASP_FONT_3 + #define LV_THEME_DEFAULT_FONT_SMALL &HASP_FONT_2 +#else // smaller than 320 + #define LV_FONT_DEFAULT &HASP_FONT_2 + #define LV_THEME_DEFAULT_FONT_SMALL &HASP_FONT_1 #endif +#endif // LV_FONT_DEFAULT + +#define LV_THEME_DEFAULT_FONT_NORMAL LV_FONT_DEFAULT +#define LV_THEME_DEFAULT_FONT_SUBTITLE LV_FONT_DEFAULT +#define LV_THEME_DEFAULT_FONT_TITLE LV_FONT_DEFAULT #endif // LV_HIGH_RESOURCE_MCU @@ -740,17 +775,17 @@ typedef void* lv_font_user_data_t; #define LV_THEME_DEFAULT_COLOR_PRIMARY LV_COLOR_RED #define LV_THEME_DEFAULT_COLOR_SECONDARY LV_COLOR_BLUE #define LV_THEME_DEFAULT_FLAG 0 //LV_THEME_MATERIAL_FLAG_NONE -#if HASP_USE_FREETYPE<=0 //LV_HIGH_RESOURCE_MCU -#define LV_THEME_DEFAULT_FONT_SMALL &HASP_FONT_1 //&lv_font_montserrat_12 -#define LV_THEME_DEFAULT_FONT_NORMAL &HASP_FONT_2 //&lv_font_montserrat_16 -#define LV_THEME_DEFAULT_FONT_SUBTITLE &HASP_FONT_2 //&lv_font_montserrat_22 -#define LV_THEME_DEFAULT_FONT_TITLE &HASP_FONT_2 //&lv_font_montserrat_22 //&lv_font_montserrat_28_compressed -#else -#define LV_THEME_DEFAULT_FONT_SMALL LV_FONT_DEFAULT // &lv_font_montserrat_12 -#define LV_THEME_DEFAULT_FONT_NORMAL LV_FONT_DEFAULT // &lv_font_montserrat_16 -#define LV_THEME_DEFAULT_FONT_SUBTITLE LV_FONT_DEFAULT // &lv_font_montserrat_22 -#define LV_THEME_DEFAULT_FONT_TITLE LV_FONT_DEFAULT // &lv_font_montserrat_28_compressed -#endif +// #if HASP_USE_FREETYPE<=0 //LV_HIGH_RESOURCE_MCU +// #define LV_THEME_DEFAULT_FONT_SMALL &HASP_FONT_1 //&lv_font_montserrat_12 +// #define LV_THEME_DEFAULT_FONT_NORMAL &HASP_FONT_2 //&lv_font_montserrat_16 +// #define LV_THEME_DEFAULT_FONT_SUBTITLE &HASP_FONT_2 //&lv_font_montserrat_22 +// #define LV_THEME_DEFAULT_FONT_TITLE &HASP_FONT_2 //&lv_font_montserrat_22 //&lv_font_montserrat_28_compressed +// #else +// #define LV_THEME_DEFAULT_FONT_SMALL LV_FONT_DEFAULT // &lv_font_montserrat_12 +// #define LV_THEME_DEFAULT_FONT_NORMAL LV_FONT_DEFAULT // &lv_font_montserrat_16 +// #define LV_THEME_DEFAULT_FONT_SUBTITLE LV_FONT_DEFAULT // &lv_font_montserrat_22 +// #define LV_THEME_DEFAULT_FONT_TITLE LV_FONT_DEFAULT // &lv_font_montserrat_28_compressed +// #endif #define LV_USE_THEME_EMPTY 0 #define LV_USE_THEME_MONO 1 diff --git a/src/hasp/hasp.cpp b/src/hasp/hasp.cpp index 5d2a8b4e..a679c9d8 100644 --- a/src/hasp/hasp.cpp +++ b/src/hasp/hasp.cpp @@ -561,38 +561,10 @@ void haspSetup(void) // LOG_WARNING(TAG_ATTR, "%s %d %x", __FILE__, __LINE__, haspFonts[0]); // LOG_WARNING(TAG_ATTR, "%s %d %x", __FILE__, __LINE__, &robotocondensed_regular_16); -#if HASP_USE_FREETYPE > 0 - -#if TFT_HEIGHT >= 480 && TFT_WIDTH >= 480 - haspFonts[0] = get_font("24"); - haspFonts[1] = get_font("32"); -#elif TFT_HEIGHT >= 320 && TFT_WIDTH >= 320 - haspFonts[0] = get_font("16"); - haspFonts[1] = get_font("24"); -#elif TFT_HEIGHT >= 272 && TFT_WIDTH >= 272 - haspFonts[0] = get_font("14"); - haspFonts[1] = get_font("18"); -#else // smaller than 272 - haspFonts[0] = get_font("12"); - haspFonts[1] = get_font("16"); -#endif - - // Check for failed font pointers - if(haspFonts[0] == nullptr) haspFonts[0] = LV_FONT_DEFAULT; - if(haspFonts[1] == nullptr) haspFonts[1] = LV_FONT_DEFAULT; - -#else - - if(haspFonts[0] == nullptr) haspFonts[0] = LV_THEME_DEFAULT_FONT_SMALL; - if(haspFonts[1] == nullptr) haspFonts[1] = LV_THEME_DEFAULT_FONT_NORMAL; - - // if(haspFonts[2] == nullptr) haspFonts[2] = LV_THEME_DEFAULT_FONT_SUBTITLE; - // if(haspFonts[3] == nullptr) haspFonts[3] = LV_THEME_DEFAULT_FONT_TITLE; - -#endif // HASP_USE_FREETYPE - - haspFonts[2] = haspFonts[1]; // subtitle isn't used in themes, set to normal font - haspFonts[3] = haspFonts[1]; // title isn't used in themes, set to normal font + haspFonts[0] = LV_THEME_DEFAULT_FONT_SMALL; + haspFonts[1] = LV_THEME_DEFAULT_FONT_NORMAL; + haspFonts[2] = LV_THEME_DEFAULT_FONT_SUBTITLE + haspFonts[3] = LV_THEME_DEFAULT_FONT_TITLE hasp_set_theme(haspThemeId);