mirror of
https://github.com/HASwitchPlate/openHASP.git
synced 2025-07-29 14:16:40 +00:00
Always include 5 default fonts
This commit is contained in:
parent
161cafcf7e
commit
8459b632c7
@ -374,6 +374,21 @@ typedef void* lv_indev_drv_user_data_t; /*Type of user data in the in
|
|||||||
*===================*/
|
*===================*/
|
||||||
|
|
||||||
#if TFT_HEIGHT>=480 || TFT_WIDTH>=480
|
#if TFT_HEIGHT>=480 || TFT_WIDTH>=480
|
||||||
|
#ifndef ROBOTOCONDENSED_REGULAR_16_LATIN1
|
||||||
|
#define ROBOTOCONDENSED_REGULAR_16_LATIN1 1
|
||||||
|
#endif
|
||||||
|
#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
|
||||||
|
#ifndef ROBOTOCONDENSED_REGULAR_12_LATIN1
|
||||||
|
#define ROBOTOCONDENSED_REGULAR_12_LATIN1 1
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifndef HASP_FONT_1
|
#ifndef HASP_FONT_1
|
||||||
#define HASP_FONT_1 robotocondensed_regular_16_latin1 /* 5% Width */
|
#define HASP_FONT_1 robotocondensed_regular_16_latin1 /* 5% Width */
|
||||||
@ -387,18 +402,8 @@ typedef void* lv_indev_drv_user_data_t; /*Type of user data in the in
|
|||||||
#ifndef HASP_FONT_4
|
#ifndef HASP_FONT_4
|
||||||
#define HASP_FONT_4 robotocondensed_regular_48_latin1 /* 10% Height */
|
#define HASP_FONT_4 robotocondensed_regular_48_latin1 /* 10% Height */
|
||||||
#endif
|
#endif
|
||||||
|
#ifndef HASP_FONT_5
|
||||||
#ifndef ROBOTOCONDENSED_REGULAR_16_LATIN1
|
#define HASP_FONT_5 robotocondensed_regular_12_latin1 /* 5% Width */
|
||||||
#define ROBOTOCONDENSED_REGULAR_16_LATIN1 1
|
|
||||||
#endif
|
|
||||||
#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
|
#ifndef HASP_FONT_SIZE_1
|
||||||
@ -413,7 +418,9 @@ typedef void* lv_indev_drv_user_data_t; /*Type of user data in the in
|
|||||||
#ifndef HASP_FONT_SIZE_4
|
#ifndef HASP_FONT_SIZE_4
|
||||||
#define HASP_FONT_SIZE_4 48
|
#define HASP_FONT_SIZE_4 48
|
||||||
#endif
|
#endif
|
||||||
|
#ifndef HASP_FONT_SIZE_5
|
||||||
|
#define HASP_FONT_SIZE_5 12
|
||||||
|
#endif
|
||||||
#else // not 320x480
|
#else // not 320x480
|
||||||
|
|
||||||
#ifndef HASP_FONT_1
|
#ifndef HASP_FONT_1
|
||||||
@ -441,6 +448,9 @@ typedef void* lv_indev_drv_user_data_t; /*Type of user data in the in
|
|||||||
#ifndef ROBOTOCONDENSED_REGULAR_32_LATIN1
|
#ifndef ROBOTOCONDENSED_REGULAR_32_LATIN1
|
||||||
#define ROBOTOCONDENSED_REGULAR_32_LATIN1 1
|
#define ROBOTOCONDENSED_REGULAR_32_LATIN1 1
|
||||||
#endif
|
#endif
|
||||||
|
#ifndef ROBOTOCONDENSED_REGULAR_48_LATIN1
|
||||||
|
#define ROBOTOCONDENSED_REGULAR_48_LATIN1 1
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifndef HASP_FONT_SIZE_1
|
#ifndef HASP_FONT_SIZE_1
|
||||||
#define HASP_FONT_SIZE_1 12
|
#define HASP_FONT_SIZE_1 12
|
||||||
@ -454,6 +464,9 @@ typedef void* lv_indev_drv_user_data_t; /*Type of user data in the in
|
|||||||
#ifndef HASP_FONT_SIZE_4
|
#ifndef HASP_FONT_SIZE_4
|
||||||
#define HASP_FONT_SIZE_4 32
|
#define HASP_FONT_SIZE_4 32
|
||||||
#endif
|
#endif
|
||||||
|
#ifndef HASP_FONT_SIZE_5
|
||||||
|
#define HASP_FONT_SIZE_5 48
|
||||||
|
#endif
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@ -570,6 +583,7 @@ typedef void* lv_font_user_data_t;
|
|||||||
LV_FONT_DECLARE(HASP_FONT_2) \
|
LV_FONT_DECLARE(HASP_FONT_2) \
|
||||||
LV_FONT_DECLARE(HASP_FONT_3) \
|
LV_FONT_DECLARE(HASP_FONT_3) \
|
||||||
LV_FONT_DECLARE(HASP_FONT_4) \
|
LV_FONT_DECLARE(HASP_FONT_4) \
|
||||||
|
LV_FONT_DECLARE(HASP_FONT_5) \
|
||||||
|
|
||||||
#ifndef LV_FONT_DEFAULT
|
#ifndef LV_FONT_DEFAULT
|
||||||
#define LV_FONT_DEFAULT &HASP_FONT_2 //&lv_font_montserrat_16
|
#define LV_FONT_DEFAULT &HASP_FONT_2 //&lv_font_montserrat_16
|
||||||
|
@ -550,43 +550,6 @@ void haspSetup(void)
|
|||||||
if(haspFonts[2] == nullptr) haspFonts[2] = LV_THEME_DEFAULT_FONT_SUBTITLE;
|
if(haspFonts[2] == nullptr) haspFonts[2] = LV_THEME_DEFAULT_FONT_SUBTITLE;
|
||||||
if(haspFonts[3] == nullptr) haspFonts[3] = LV_THEME_DEFAULT_FONT_TITLE;
|
if(haspFonts[3] == nullptr) haspFonts[3] = LV_THEME_DEFAULT_FONT_TITLE;
|
||||||
|
|
||||||
// haspFonts[0] = lv_font_load("E:/font_1.fnt");
|
|
||||||
// haspFonts[2] = lv_font_load("E:/font_2.fnt");
|
|
||||||
|
|
||||||
/*
|
|
||||||
#if defined(ARDUINO_ARCH_ESP32)
|
|
||||||
// lv_ft_info_t info1;
|
|
||||||
// info1.name = "L:/arial.ttf";
|
|
||||||
// info1.weight = 48;
|
|
||||||
// info1.style = FT_FONT_STYLE_NORMAL;
|
|
||||||
// lv_ft_font_init(&info1);
|
|
||||||
// haspFonts[4] = info1.font;
|
|
||||||
haspFonts[4] = get_font("arial"); // "L:/arial.ttf", 45, FT_FONT_STYLE_NORMAL);
|
|
||||||
LOG_WARNING(TAG_ATTR, "%s %d %x", __FILE__, __LINE__, haspFonts[4]);
|
|
||||||
|
|
||||||
// lv_ft_info_t info2;
|
|
||||||
// info2.name = "L:/mdi.ttf";
|
|
||||||
// info2.weight = 92;
|
|
||||||
// info2.style = FT_FONT_STYLE_NORMAL;
|
|
||||||
// lv_ft_font_init(&info2);
|
|
||||||
// haspFonts[5] = info2.font;
|
|
||||||
haspFonts[5] = get_font("mdi"); // "L:/mdi.ttf", 80, FT_FONT_STYLE_NORMAL);
|
|
||||||
LOG_WARNING(TAG_ATTR, "%s %d %x", __FILE__, __LINE__, haspFonts[5]);
|
|
||||||
|
|
||||||
// lv_ft_info_t info3;
|
|
||||||
// info3.name = "L:/robotocondensed.ttf";
|
|
||||||
// info3.weight = 48;
|
|
||||||
// info3.style = FT_FONT_STYLE_NORMAL;
|
|
||||||
// lv_ft_font_init(&info3);
|
|
||||||
// haspFonts[6] = info3.font;
|
|
||||||
haspFonts[6] = get_font("robotocondensed"); // "L:/robotocondensed.ttf", 48, FT_FONT_STYLE_NORMAL);
|
|
||||||
LOG_WARNING(TAG_ATTR, "%s %d %x", __FILE__, __LINE__, haspFonts[6]);
|
|
||||||
|
|
||||||
haspFonts[7] = hasp_font_load("L:/RobotoCondensedRegular.bin");
|
|
||||||
LOG_WARNING(TAG_ATTR, "%s %d %x", __FILE__, __LINE__, haspFonts[7]);
|
|
||||||
#endif
|
|
||||||
*/
|
|
||||||
|
|
||||||
hasp_set_theme(haspThemeId);
|
hasp_set_theme(haspThemeId);
|
||||||
|
|
||||||
/* Create all screens using the theme */
|
/* Create all screens using the theme */
|
||||||
|
@ -264,6 +264,12 @@ static lv_font_t* haspPayloadToFont(const char* payload)
|
|||||||
return &HASP_FONT_4;
|
return &HASP_FONT_4;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifdef HASP_FONT_5
|
||||||
|
case HASP_FONT_SIZE_5:
|
||||||
|
LOG_DEBUG(TAG_ATTR, "%s %d %x", __FILE__, __LINE__, HASP_FONT_5);
|
||||||
|
return &HASP_FONT_5;
|
||||||
|
#endif
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
default:
|
default:
|
||||||
|
@ -161,6 +161,7 @@ static lv_font_t* font_add_to_list(const char* payload)
|
|||||||
size_t pos = font_split_payload(payload);
|
size_t pos = font_split_payload(payload);
|
||||||
if(pos > 0 && pos < 56) {
|
if(pos > 0 && pos < 56) {
|
||||||
uint16_t size = atoi(payload + pos);
|
uint16_t size = atoi(payload + pos);
|
||||||
|
if(payload[pos - 1] == '_') pos--; // trancate trailing underscore
|
||||||
|
|
||||||
char fontname[64];
|
char fontname[64];
|
||||||
memset(fontname, 0, sizeof(fontname));
|
memset(fontname, 0, sizeof(fontname));
|
||||||
|
Loading…
x
Reference in New Issue
Block a user