diff --git a/lib/libesp32_lvgl/LVGL_assets/roboto/robotocondensed_latin1.be b/lib/libesp32_lvgl/LVGL_assets/roboto/robotocondensed_latin1.be index 713340c60..1381e80e5 100644 --- a/lib/libesp32_lvgl/LVGL_assets/roboto/robotocondensed_latin1.be +++ b/lib/libesp32_lvgl/LVGL_assets/roboto/robotocondensed_latin1.be @@ -6,9 +6,35 @@ font_robotocondensed_latin1.init = def (m) import lv var wd = tasmota.wd # save current working dir - lv.font_robotocondensed_latin1 = def (size) - return lv.load_font("A:" + wd + "robotocondensed_latin1_" + str(size) + ".bin") + class robotocondensed_latin1_loader + var wd + var font_cache + def init(wd) + self.wd = wd + self.font_cache = {} + end + + def load_robotocondensed_latin1(sz) + sz = int(sz) + var font + # is the font already embedded? + try + font = lv.font_embedded("robotocondensed", sz) + except .. + end + if (font) return font end + # is the font in our local cache? + font = self.font_cache.find(sz) + if (font) return font end + # load the font from the archive + font = lv.load_font("A:" + wd + "robotocondensed_latin1_" + str(sz) + ".bin") + self.font_cache[sz] = font + return font + end end + + var monad = robotocondensed_latin1_loader(wd) + lv.font_robotocondensed_latin1 = / sz -> monad.load_robotocondensed_latin1(sz) end return font_robotocondensed_latin1 diff --git a/lib/libesp32_lvgl/LVGL_assets/roboto/robotocondensed_latin1.sh b/lib/libesp32_lvgl/LVGL_assets/roboto/robotocondensed_latin1.sh new file mode 100644 index 000000000..e3573f14a --- /dev/null +++ b/lib/libesp32_lvgl/LVGL_assets/roboto/robotocondensed_latin1.sh @@ -0,0 +1,6 @@ +#!/bin/bash +set -x #echo on + +rm robotocondensed_latin1.tapp +zip -j -0 robotocondensed_latin1.zip autoexec.be robotocondensed_latin1.be robotocondensed_latin1_12.bin robotocondensed_latin1_14.bin robotocondensed_latin1_16.bin robotocondensed_latin1_24.bin robotocondensed_latin1_32.bin +mv robotocondensed_latin1.zip robotocondensed_latin1.tapp diff --git a/lib/libesp32_lvgl/LVGL_assets/roboto/robotocondensed_latin1.tapp b/lib/libesp32_lvgl/LVGL_assets/roboto/robotocondensed_latin1.tapp index bf714bc6e..e4c8ca84c 100644 Binary files a/lib/libesp32_lvgl/LVGL_assets/roboto/robotocondensed_latin1.tapp and b/lib/libesp32_lvgl/LVGL_assets/roboto/robotocondensed_latin1.tapp differ