lv_font_fmt_txt.h
API reference for lv_font_fmt_txt.h
Functions
lv_font_get_bitmap_fmt_txt
Used as get_glyph_bitmap callback in lvgl's native font format if the font is uncompressed.
const void * lv_font_get_bitmap_fmt_txt(lv_font_glyph_dsc_t *g_dsc, lv_draw_buf_t *draw_buf)| Name | Type | Description |
|---|---|---|
g_dsc | lv_font_glyph_dsc_t * | the glyph descriptor including which font to use, which supply the glyph_index and format. |
draw_buf | lv_draw_buf_t * | a draw buffer that can be used to store the bitmap of the glyph, it's OK not to use it. |
Returns: const void * — pointer to an A8 bitmap (not necessarily bitmap_out) or NULL if unicode_letter not found
lv_font_get_glyph_dsc_fmt_txt
Used as get_glyph_dsc callback in lvgl's native font format if the font is uncompressed.
bool lv_font_get_glyph_dsc_fmt_txt(const lv_font_t *font, lv_font_glyph_dsc_t *dsc_out, uint32_t unicode_letter, uint32_t unicode_letter_next)| Name | Type | Description |
|---|---|---|
font | const lv_font_t * | pointer to font |
dsc_out | lv_font_glyph_dsc_t * | store the result descriptor here |
unicode_letter | uint32_t | a UNICODE letter code |
unicode_letter_next | uint32_t | the unicode letter succeeding the letter under test |
Returns: bool — true: descriptor is successfully loaded into dsc_out. false: the letter was not found, no data is loaded to dsc_out
Enums
lv_font_fmt_txt_cmap_type_t
Format of font character map.
| Name |
|---|
LV_FONT_FMT_TXT_CMAP_FORMAT0_FULL |
LV_FONT_FMT_TXT_CMAP_SPARSE_FULL |
LV_FONT_FMT_TXT_CMAP_FORMAT0_TINY |
LV_FONT_FMT_TXT_CMAP_SPARSE_TINY |
lv_font_fmt_txt_bitmap_format_t
Bitmap formats
| Name | Value |
|---|---|
LV_FONT_FMT_TXT_PLAIN | 0 |
LV_FONT_FMT_TXT_COMPRESSED | 1 |
LV_FONT_FMT_TXT_COMPRESSED_NO_PREFILTER | 2 |
Structs
lv_font_fmt_txt_glyph_dsc_t
This describes a glyph.
| Member | Type | Description |
|---|---|---|
bitmap_index | uint32_t | Start index of the bitmap. A font can be max 1 MB. |
adv_w | uint32_t | Draw the next glyph after this width. 8.4 format (real_value * 16 is stored). |
box_w | uint8_t | Width of the glyph's bounding box |
box_h | uint8_t | Height of the glyph's bounding box |
ofs_x | int8_t | x offset of the bounding box |
ofs_y | int8_t | y offset of the bounding box. Measured from the top of the line |
lv_font_fmt_txt_cmap_t
Map codepoints to a glyph_dscs Several formats are supported to optimize memory usage See https://github.com/lvgl/lv_font_conv/blob/master/doc/font_spec.md
| Member | Type | Description |
|---|---|---|
range_start | uint32_t | First Unicode character for this range |
range_length | uint16_t | Number of Unicode characters related to this range. Last Unicode character = range_start + range_length - 1 |
glyph_id_start | uint16_t | First glyph ID (array index of glyph_dsc) for this range |
unicode_list | const uint16_t * | |
glyph_id_ofs_list | const void * | if(type == LV_FONT_FMT_TXT_CMAP_FORMAT0_...) it's uint8_t * if(type == LV_FONT_FMT_TXT_CMAP_SPARSE_...) it's uint16_t * |
list_length | uint16_t | Length of unicode_list and/or glyph_id_ofs_list |
type | lv_font_fmt_txt_cmap_type_t | Type of this character map |
lv_font_fmt_txt_kern_pair_t
A simple mapping of kern values from pairs
| Member | Type | Description |
|---|---|---|
glyph_ids | const void * | |
values | const int8_t * | |
pair_cnt | uint32_t | |
glyph_ids_size | uint32_t | 0: glyph_ids is stored as uint8_t; 1: as uint16_t |
lv_font_fmt_txt_kern_classes_t
More complex but more optimal class based kern value storage
| Member | Type | Description |
|---|---|---|
class_pair_values | const int8_t * | left_class_cnt * right_class_cnt value |
left_class_mapping | const uint8_t * | Map the glyph_ids to classes: index -> glyph_id -> class_id |
right_class_mapping | const uint8_t * | Map the glyph_ids to classes: index -> glyph_id -> class_id |
left_class_cnt | uint8_t | |
right_class_cnt | uint8_t |
lv_font_fmt_txt_dsc_t
Describe store for additional data for fonts
| Member | Type | Description |
|---|---|---|
glyph_bitmap | const uint8_t * | The bitmaps of all glyphs |
glyph_dsc | const lv_font_fmt_txt_glyph_dsc_t * | Describe the glyphs |
cmaps | const lv_font_fmt_txt_cmap_t * | Map the glyphs to Unicode characters. Array of lv_font_cmap_fmt_txt_t variables |
kern_dsc | const void * | Store kerning values. Can be lv_font_fmt_txt_kern_pair_t * orlv_font_kern_classes_fmt_txt_t * depending onkern_classes` |
kern_scale | uint16_t | Scale kern values in 12.4 format |
cmap_num | uint16_t | Number of cmap tables |
bpp | uint16_t | Bit per pixel: 1, 2, 3, 4, 8 |
kern_classes | uint16_t | Type of kern_dsc |
bitmap_format | uint16_t | storage format of the bitmap from lv_font_fmt_txt_bitmap_format_t |
stride | uint8_t | Bytes to which each line is padded. 0: means no align and padding 1: e.g. with bpp=4 lines are aligned to 1 byte, so there can be a 4 bits of padding 4, 8, 16, 32, 64: each line is padded to the given byte boundaries |
Used by 1 function
lv_draw_eve_label_upload_glyph— paramfont_dsc
lv_builtin_font_src_t
| Member | Type | Description |
|---|---|---|
font_p | const lv_font_t * | Pointer to built-in font |
size | uint32_t |
Variables
lv_builtin_font_class
const lv_font_class_t lv_builtin_font_classDependencies
How is this guide?
Last updated on