1.. _lv_imgfont: 2 3========== 4Image font 5========== 6 7Draw image in **label** or **span** obj with :cpp:type:`lv_imgfont`. This is often used to 8display Unicode emoji icons in text. 9 10Supported image formats: determined by enabled LVGL :ref:`image decoders <overview_image_decoder>`. 11 12 13 14.. _lv_imgfont_usage: 15 16Usage 17***** 18 19Enable :c:macro:`LV_USE_IMGFONT` in ``lv_conf.h``. 20 21To create a new *imgfont*: 22 23.. code-block:: c 24 25 static lv_font_t * imgfont; 26 ... 27 imgfont = lv_imgfont_create(height, path_cb, user_data); 28 29- ``height`` Font size. 30- ``path_cb`` A function to get the image path of a character. 31 Pass ``NULL`` if no image should be shown, but the character itself. 32- ``user_data`` Pointer to user data. 33 34To use the *imgfont* in a label, reference it: 35:cpp:expr:`lv_obj_set_style_text_font(label, imgfont, LV_PART_MAIN)` 36 37To destroy the *imgfont* that is no longer used, use :cpp:expr:`lv_imgfont_destroy(imgfont)`. 38 39 40 41.. _lv_imgfont_example: 42 43Example 44******* 45 46.. include:: ../../examples/others/imgfont/index.rst 47 48 49 50.. _lv_imgfont_api: 51 52API 53*** 54