Image font
Draw image in label or span obj with lv_imgfont. This is often used to display Unicode emoji icons in text.
Draw image in label or span obj with lv_imgfont. This is often used to
display Unicode emoji icons in text.
Supported image formats: determined by enabled LVGL image decoders.
Usage
Enable LV_USE_IMGFONT in lv_conf.h.
To create a new imgfont:
static lv_font_t * imgfont;
...
imgfont = lv_imgfont_create(height, path_cb, user_data);heightFont size.path_cbA function to get the image path of a character. PassNULLif no image should be shown, but the character itself.user_dataPointer to user data.
To use the imgfont in a label, reference it:
lv_obj_set_style_text_font(label, imgfont, LV_PART_MAIN)
To destroy the imgfont that is no longer used, use lv_imgfont_destroy(imgfont).
Example
Use emojis in a text.
API
How is this guide?
Last updated on
BinFont Loader
lv_binfont_create can be used to load a font from a file. The font needs to have a special binary format.
BDF Font
Small displays with low resolution don't look pretty with automatically rendered fonts. A bitmap font provides the solution, but it's necessary to convert the bitmap font (BDF) to a TTF.