lv_font_fmt_txt.h

API reference for lv_font_fmt_txt.h

Report on GitHub
See Also: Private HeaderThis header has a companion private implementation with internal data structures.lv_font_fmt_txt_private.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)
Parameters
NameTypeDescription
g_dsclv_font_glyph_dsc_t *the glyph descriptor including which font to use, which supply the glyph_index and format.
draw_buflv_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)
Parameters
NameTypeDescription
fontconst lv_font_t *pointer to font
dsc_outlv_font_glyph_dsc_t *store the result descriptor here
unicode_letteruint32_ta UNICODE letter code
unicode_letter_nextuint32_tthe 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

NameValue
LV_FONT_FMT_TXT_PLAIN0
LV_FONT_FMT_TXT_COMPRESSED1
LV_FONT_FMT_TXT_COMPRESSED_NO_PREFILTER2

Structs

struct

lv_font_fmt_txt_glyph_dsc_t

This describes a glyph.

MemberTypeDescription
bitmap_indexuint32_tStart index of the bitmap. A font can be max 1 MB.
adv_wuint32_tDraw the next glyph after this width. 8.4 format (real_value * 16 is stored).
box_wuint8_tWidth of the glyph's bounding box
box_huint8_tHeight of the glyph's bounding box
ofs_xint8_tx offset of the bounding box
ofs_yint8_ty offset of the bounding box. Measured from the top of the line
struct

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

MemberTypeDescription
range_startuint32_tFirst Unicode character for this range
range_lengthuint16_tNumber of Unicode characters related to this range. Last Unicode character = range_start + range_length - 1
glyph_id_startuint16_tFirst glyph ID (array index of glyph_dsc) for this range
unicode_listconst uint16_t *
glyph_id_ofs_listconst 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_lengthuint16_tLength of unicode_list and/or glyph_id_ofs_list
typelv_font_fmt_txt_cmap_type_tType of this character map
struct

lv_font_fmt_txt_kern_pair_t

A simple mapping of kern values from pairs

MemberTypeDescription
glyph_idsconst void *
valuesconst int8_t *
pair_cntuint32_t
glyph_ids_sizeuint32_t0: glyph_ids is stored as uint8_t; 1: as uint16_t
struct

lv_font_fmt_txt_kern_classes_t

More complex but more optimal class based kern value storage

MemberTypeDescription
class_pair_valuesconst int8_t *left_class_cnt * right_class_cnt value
left_class_mappingconst uint8_t *Map the glyph_ids to classes: index -> glyph_id -> class_id
right_class_mappingconst uint8_t *Map the glyph_ids to classes: index -> glyph_id -> class_id
left_class_cntuint8_t
right_class_cntuint8_t
struct

lv_font_fmt_txt_dsc_t

Describe store for additional data for fonts

MemberTypeDescription
glyph_bitmapconst uint8_t *The bitmaps of all glyphs
glyph_dscconst lv_font_fmt_txt_glyph_dsc_t *Describe the glyphs
cmapsconst lv_font_fmt_txt_cmap_t *Map the glyphs to Unicode characters. Array of lv_font_cmap_fmt_txt_t variables
kern_dscconst void *Store kerning values. Can be lv_font_fmt_txt_kern_pair_t * orlv_font_kern_classes_fmt_txt_t * depending onkern_classes`
kern_scaleuint16_tScale kern values in 12.4 format
cmap_numuint16_tNumber of cmap tables
bppuint16_tBit per pixel: 1, 2, 3, 4, 8
kern_classesuint16_tType of kern_dsc
bitmap_formatuint16_tstorage format of the bitmap from lv_font_fmt_txt_bitmap_format_t
strideuint8_tBytes 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 — param font_dsc
struct

lv_builtin_font_src_t

MemberTypeDescription
font_pconst lv_font_t *Pointer to built-in font
sizeuint32_t

Variables

lv_builtin_font_class

 
const lv_font_class_t lv_builtin_font_class

Dependencies

How is this guide?

Last updated on

On this page