Loading fonts at runtime ? (bin-file already created)

Hello,

While browsing the lvgl documentation, I stumbled up on some information on how to load a font at runtime:
I can’t include links in my postings,so look at docs . lvgl . io and look for lv_font_load
I already made a bin-file from the font I want to use, and uploaded it to the same directory as where my .py-files are on my device. I already had a look at some forum topics, but they didn’t make me any smarter :frowning:

How can I use this functionality in MicroPython ?
A simple example would be nice :slight_smile:

Best regards from Belgium,
Kris

Hi @Sn00zerman!

Thanks to the work of @imliubo and @mhepp, we now have a Micropython example for loading fonts dynamically!

Thanks for this quick response :+1:

I’m however unable to use this, I get: ‘module’ object has no attribute ‘font_load’.
I think I need a new firmware ?
(i’m running “MicroPython v1.9.4-2811-gf0cb439ba-dirty on 2020-07-23; LilyGO-TTGO-T-Watch-2020-V1 with ESP32” from https://github.com/OPHoperHPO/lilygo-ttgo-twatch-2020-micropython

I think it’s time to learn to compile my own firmware then …
(I was able to do this in the past, but whatever I do (edition the partions.csv etc …),
I always end un with a 2 MB filesystem, and 512KB Ram, and when I use the pre-compiled firmware, I have 13 MB filesystem and 3 MB Ram)

Not strictly lvgl related, but somebody is also using the TTGO T-watch 2020, and is willing to share his compiled firmware ?

best regards,
Kris
Best regards,
Kris

Yes you need an updated version.
lv_micropython is based on Micropython v.13 and an up to date LVGL which supports dynamic font loading.

You could also try opening a GitHub issue on https://github.com/OPHoperHPO/lilygo-ttgo-twatch-2020-micropython and ask him to update his libraries.

1 Like