feat(font): add imgfont - can be used to add emojis to label/span (#3160)

* feature(font): draw img in label/span

* add to tests

Co-authored-by: Gabor Kiss-Vamosi <kisvegabor@gmail.com>
This commit is contained in:
guoweilkd
2022-03-17 17:18:14 +08:00
committed by GitHub
parent 7153e3f8b7
commit 7713327d61
16 changed files with 676 additions and 0 deletions

29
docs/others/imgfont.md Normal file
View File

@@ -0,0 +1,29 @@
```eval_rst
.. include:: /header.rst
:github_url: |github_link_base|/others/imgfont.md
```
## Image font (imgfont)
Draw image in label or span obj with imgfont.
This is often used to display Unicode emoji icons in text.
Supported image formats: determined by LVGL image decoder.
## Usage
Enable `LV_USE_IMGFONT` in `lv_conf.h`.
To create a new imgfont use `lv_imgfont_create(height, path_cb)`.
`height` used to indicate the size of a imgfont.
`path_cb` Used to get the image path of the specified unicode.
Use `lv_imgfont_destroy(imgfont)` to destroy a imgfont that is no longer used.
## Example
```eval_rst
.. include:: ../../examples/others/imgfont/index.rst
```
## API
```eval_rst
.. doxygenfile:: lv_imgfont.h
:project: lvgl
```