Tasmota/lib/libesp32_lvgl/LVGL_assets/roboto/robotocondensed_latin1.be

49 lines
1.2 KiB
Plaintext
Raw Normal View History

2021-12-27 17:12:38 +00:00
# Extend module `lv` with `font_robotocondensed_latin1(size)`
var font_robotocondensed_latin1 = module("font_robotocondensed_latin1")
font_robotocondensed_latin1.init = def (m)
import lv
var wd = tasmota.wd # save current working dir
2022-03-24 12:00:08 +00:00
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
2021-12-27 17:12:38 +00:00
end
2022-03-24 12:00:08 +00:00
var monad = robotocondensed_latin1_loader(wd)
lv.font_robotocondensed_latin1 = / sz -> monad.load_robotocondensed_latin1(sz)
2021-12-27 17:12:38 +00:00
end
return font_robotocondensed_latin1
#-
font_robotocondensed_latin1.init(font_robotocondensed_latin1)
print(lv.font_robotocondensed_latin1)
print(lv.font_robotocondensed_latin1(32))
-#