From 38d308a07b56eb81f6d7b70033f610dfbdd5bd1b Mon Sep 17 00:00:00 2001 From: fvanroie Date: Tue, 17 Jan 2023 01:42:04 +0100 Subject: [PATCH] Omit bitmap fonts --- src/hasp/hasp.cpp | 1 + src/hasp/hasp_attribute.cpp | 7 +++---- src/hasp/hasp_font.cpp | 10 ++++++++-- 3 files changed, 12 insertions(+), 6 deletions(-) diff --git a/src/hasp/hasp.cpp b/src/hasp/hasp.cpp index 93f3550c..d6d5de58 100644 --- a/src/hasp/hasp.cpp +++ b/src/hasp/hasp.cpp @@ -585,6 +585,7 @@ void haspSetup(void) haspFonts[3] = get_font("32"); #endif + // Check for failed font pointers if(haspFonts[0] == nullptr) haspFonts[0] = LV_FONT_DEFAULT; if(haspFonts[1] == nullptr) haspFonts[1] = LV_FONT_DEFAULT; if(haspFonts[2] == nullptr) haspFonts[2] = LV_FONT_DEFAULT; diff --git a/src/hasp/hasp_attribute.cpp b/src/hasp/hasp_attribute.cpp index 57f3e603..74763117 100644 --- a/src/hasp/hasp_attribute.cpp +++ b/src/hasp/hasp_attribute.cpp @@ -239,7 +239,7 @@ static lv_font_t* haspPayloadToFont(const char* payload) else if(var == 8) return &unscii_8_icon; -#ifndef ARDUINO_ARCH_ESP8266 +#if !defined(ARDUINO_ARCH_ESP8266) && (HASP_USE_FREETYPE == 0) #ifdef HASP_FONT_1 else if(var == HASP_FONT_SIZE_1) @@ -266,11 +266,10 @@ static lv_font_t* haspPayloadToFont(const char* payload) // return &HASP_FONT_5; // #endif -#endif // ARDUINO_ARCH_ESP8266 - +#endif } - return get_font(payload); + return get_font(payload); } static hasp_attribute_type_t hasp_process_label_long_mode(lv_obj_t* obj, const char* payload, char** text, bool update) diff --git a/src/hasp/hasp_font.cpp b/src/hasp/hasp_font.cpp index 8c732021..c5d7b22f 100644 --- a/src/hasp/hasp_font.cpp +++ b/src/hasp/hasp_font.cpp @@ -1,3 +1,6 @@ +/* MIT License - Copyright (c) 2019-2023 Francis Van Roie + For full license information read the LICENSE file in the project folder */ + #include #include "hasplib.h" @@ -24,10 +27,13 @@ typedef struct #include "font/hasp_font_loader.h" #if defined(ARDUINO_ARCH_ESP32) && (HASP_USE_FREETYPE > 0) // && defined(ESP32S3) +// #if ESP_FLASH_SIZE > 4 extern const uint8_t OPENHASP_TTF_START[] asm("_binary_data_openhasp_ttf_start"); extern const uint8_t OPENHASP_TTF_END[] asm("_binary_data_openhasp_ttf_end"); -// extern const uint8_t OPENHASPLITE_TTF_START[] asm("_binary_data_openhasplite_ttf_start"); -// extern const uint8_t OPENHASPLITE_TTF_END[] asm("_binary_data_openhasplite_ttf_end"); +// #else +// extern const uint8_t OPENHASP_TTF_START[] asm("_binary_data_openhasplite_ttf_start"); +// extern const uint8_t OPENHASP_TTF_END[] asm("_binary_data_openhasplite_ttf_end"); +// #endif #endif static lv_ll_t hasp_fonts_ll;