diff --git a/.gitmodules b/.gitmodules index 2b84a157..209f6962 100644 --- a/.gitmodules +++ b/.gitmodules @@ -1,6 +1,3 @@ [submodule "lib/freetype"] path = lib/freetype url = https://github.com/fvanroie/freetype -[submodule "lib/lv_lib_freetype"] - path = lib/lv_lib_freetype - url = https://github.com/fvanroie/lv_lib_freetype diff --git a/src/hasp_png.h b/include/hasp_png.h similarity index 91% rename from src/hasp_png.h rename to include/hasp_png.h index 0fa8b8fb..ee1325cd 100644 --- a/src/hasp_png.h +++ b/include/hasp_png.h @@ -12,6 +12,7 @@ extern "C" { #endif +void* lodepng_calloc(size_t num,size_t size); void* lodepng_malloc(size_t size); void* lodepng_realloc(void* ptr, size_t new_size); void lodepng_free(void* ptr); diff --git a/src/hasp/hasp.cpp b/src/hasp/hasp.cpp index 7b8da115..615d2463 100644 --- a/src/hasp/hasp.cpp +++ b/src/hasp/hasp.cpp @@ -31,6 +31,8 @@ //#include "hasp_filesystem.h" included in hasp_conf.h #endif +#include "lv_freetype.h" + #if HASP_USE_EEPROM > 0 #include "EEPROM.h" #endif @@ -455,6 +457,16 @@ void haspSetup(void) { haspDevice.set_backlight_level(haspStartDim); + // #ifdef 1 || USE_LVGL_FREETYPE + // initialize the FreeType renderer + if(lv_freetype_init(USE_LVGL_FREETYPE_MAX_FACES, USE_LVGL_FREETYPE_MAX_SIZES, psramFound() ? USE_LVGL_FREETYPE_MAX_BYTES_PSRAM : USE_LVGL_FREETYPE_MAX_BYTES)) { + LOG_VERBOSE(TAG_FONT, F("FreeType v%d.%d.%d " D_SERVICE_STARTED), FREETYPE_MAJOR, FREETYPE_MINOR, + FREETYPE_PATCH); + } else { + LOG_ERROR(TAG_FONT, F("FreeType " D_SERVICE_START_FAILED)); + } + // #endif + /******* File System Test ********************************************************************/ // lv_fs_file_t f; // lv_fs_res_t res; @@ -518,7 +530,14 @@ void haspSetup(void) // haspFonts[0] = lv_font_load("E:/font_1.fnt"); // haspFonts[2] = lv_font_load("E:/font_2.fnt"); - // haspFonts[3] = hasp_font_load("L:/robotocondensed_60_latin1.bin"); + haspFonts[6] = hasp_font_load("L:/RobotoCondensedRegular.bin"); + + lv_ft_info_t info; + info.name = "L:/mdi.ttf"; + info.weight = 12; + info.style = FT_FONT_STYLE_NORMAL; + lv_ft_font_init(&info); + haspFonts[7] = info.font; hasp_set_theme(haspThemeId); diff --git a/user_setups/esp32/lolin-d32-pro_ili9341.ini b/user_setups/esp32/lolin-d32-pro_ili9341.ini index 85832d87..ae45d8e0 100644 --- a/user_setups/esp32/lolin-d32-pro_ili9341.ini +++ b/user_setups/esp32/lolin-d32-pro_ili9341.ini @@ -29,10 +29,17 @@ build_flags = -D TOUCH_CS=12 ; Default for TFT connector ;endregion + -D LV_USE_FT_CACHE_MANAGER=1 ; crashes without cache + -D USE_LVGL_FREETYPE_MAX_FACES=64 ; max number of FreeType faces in cache + -D USE_LVGL_FREETYPE_MAX_SIZES=4 ; max number of sizes in cache + -D USE_LVGL_FREETYPE_MAX_BYTES=16384 ; max bytes in cache + -D USE_LVGL_FREETYPE_MAX_BYTES_PSRAM=65536 ; max bytes in cache when using PSRAM + ;region -- Library options ------------------------------- lib_deps = ${env.lib_deps} ${esp32.lib_deps} + ;git+https://gitlab.freedesktop.org/freetype/freetype.git lib_ignore = ${env.lib_ignore}