Description
I’m testing tinyTTF to change the font size at runtime.
Embedding and using the font file (use lv_tiny_ttf_create_data
) was successful.
To reduce FW size during OTA, I tried including a font file in the filesystem(use SPIFFS
) and streaming from the file (use lv_tiny_ttf_create_file
), but it can’t create fonts.
The code was written using lv_fs_if for the LVGL filesystem interface. (use lv_fs_pc.c
because the STDIO API is supported in ESP32)
What MCU/Processor/Board and compiler are you using?
ESP32-S3-Korvo-2
What do you want to achieve?
Create dynamic font data at runtime(from filesystem) using Tiny TTF.
What have you tried so far?
I used lv_fs_open
to directly open the font file in the file system and read the data. This was successful.
But when I try using lv_tiny_ttf_create_file
, it blocked within the function.
Code to reproduce
Below is the file open test code.
This has been tried with both LVGL v8.4 and v9.1.
lv_port_fs_init();
#if 1
lv_fs_file_t lv_file;
lv_fs_res_t ret = lv_fs_open(&lv_file, "A:/spiffs/subset_custom.ttf", LV_FS_MODE_RD);
ESP_LOGI(TAG, "%d", ret);
uint8_t buf[3];
uint32_t br;
ret = lv_fs_read(&lv_file, buf, 3, &br);
ESP_LOGI(TAG, "%d, %d [%X %X %X]", ret, br, buf[0], buf[1], buf[2]);
lv_font_t *vectorFont = NULL;
#else
lv_font_t *vectorFont = lv_tiny_ttf_create_file ("A:/spiffs/subset_custom.ttf", 20);
Screenshot and/or video
N/A
[Edit]
lv_tiny_ttf_create_file
is success. but if style(lv_style_t
) applied with the created font(lv_font_t
) is added to the label, it blocked.
lv_obj_t *vect_label = lv_label_create (lv_scr_act ());
static lv_style_t vect_style;
lv_port_fs_init();
lv_font_t *vectorFont = lv_tiny_ttf_create_file ("A:/spiffs/subset_custom.ttf", 20);
lv_style_set_text_font(&vect_style, vectorFont);
lv_style_set_text_align(&vect_style, LV_TEXT_ALIGN_CENTER);
lv_obj_add_style(vect_label, &vect_style, 0); // blocked point