lv_font.h¶
Defines
-
LV_FONT_DECLARE(font_name)¶
Enums
-
enum lv_font_glyph_format_t¶
The font format.
Values:
-
enumerator LV_FONT_GLYPH_FORMAT_NONE¶
Maybe not visible Legacy simple formats with no byte padding at end of the lines
-
enumerator LV_FONT_GLYPH_FORMAT_A1¶
1 bit per pixel
-
enumerator LV_FONT_GLYPH_FORMAT_A2¶
2 bit per pixel
-
enumerator LV_FONT_GLYPH_FORMAT_A3¶
3 bit per pixel
-
enumerator LV_FONT_GLYPH_FORMAT_A4¶
4 bit per pixel
-
enumerator LV_FONT_GLYPH_FORMAT_A8¶
8 bit per pixel
-
enumerator LV_FONT_GLYPH_FORMAT_IMAGE¶
Image format Advanced formats
-
enumerator LV_FONT_GLYPH_FORMAT_VECTOR¶
Vectorial format
-
enumerator LV_FONT_GLYPH_FORMAT_SVG¶
SVG format
-
enumerator LV_FONT_GLYPH_FORMAT_CUSTOM¶
Custom format
-
enumerator LV_FONT_GLYPH_FORMAT_NONE¶
Functions
-
const void *lv_font_get_glyph_bitmap(lv_font_glyph_dsc_t *g_dsc, lv_draw_buf_t *draw_buf)¶
Return with the bitmap of a font. It always converts the normal fonts to A8 format in a draw_buf with LV_DRAW_BUF_ALIGN and LV_DRAW_BUF_STRIDE_ALIGN
Note
You must call lv_font_get_glyph_dsc() to get
g_dsc
(lv_font_glyph_dsc_t) before you can call this function.- Parameters:
g_dsc – the glyph descriptor including which font to use, which supply the glyph_index and the format.
draw_buf – a draw buffer that can be used to store the bitmap of the glyph.
- Returns:
pointer to the glyph's data. It can be a draw buffer for bitmap fonts or an image source for imgfonts.
-
const void *lv_font_get_glyph_static_bitmap(lv_font_glyph_dsc_t *g_dsc)¶
Return the bitmap as it is. It works only if the font stores the bitmap in a non-volitile memory.
- Parameters:
g_dsc – the glyph descriptor including which font to use, which supply the glyph_index and the format.
- Returns:
the bitmap as it is
-
bool lv_font_get_glyph_dsc(const lv_font_t *font, lv_font_glyph_dsc_t *dsc_out, uint32_t letter, uint32_t letter_next)¶
Get the descriptor of a glyph
- Parameters:
font – pointer to font
dsc_out – store the result descriptor here
letter – a UNICODE letter code
letter_next – the next letter after
letter
. Used for kerning
- Returns:
true: descriptor is successfully loaded into
dsc_out
. false: the letter was not found, no data is loaded todsc_out
-
void lv_font_glyph_release_draw_data(lv_font_glyph_dsc_t *g_dsc)¶
Release the bitmap of a font.
Note
You must call lv_font_get_glyph_dsc() to get
g_dsc
(lv_font_glyph_dsc_t) before you can call this function.- Parameters:
g_dsc – the glyph descriptor including which font to use, which supply the glyph_index and the format.
-
uint16_t lv_font_get_glyph_width(const lv_font_t *font, uint32_t letter, uint32_t letter_next)¶
Get the width of a glyph with kerning
- Parameters:
font – pointer to a font
letter – a UNICODE letter
letter_next – the next letter after
letter
. Used for kerning
- Returns:
the width of the glyph
-
int32_t lv_font_get_line_height(const lv_font_t *font)¶
Get the line height of a font. All characters fit into this height
- Parameters:
font – pointer to a font
- Returns:
the height of a font
-
void lv_font_set_kerning(lv_font_t *font, lv_font_kerning_t kerning)¶
Configure the use of kerning information stored in a font
- Parameters:
font – pointer to a font
kerning –
LV_FONT_KERNING_NORMAL
(default) orLV_FONT_KERNING_NONE
-
const lv_font_t *lv_font_get_default(void)¶
Get the default font, defined by LV_FONT_DEFAULT
- Returns:
return pointer to the default font
-
bool lv_font_info_is_equal(const lv_font_info_t *ft_info_1, const lv_font_info_t *ft_info_2)¶
Compare font information.
- Parameters:
ft_info_1 – font information 1.
ft_info_2 – font information 2.
- Returns:
return true if the fonts are equal.
-
bool lv_font_has_static_bitmap(const lv_font_t *font)¶
Checks if a font has a static rendering bitmap.
- Parameters:
font – pointer to a font
- Returns:
return true if the font has a bitmap generated for static rendering.
Variables
-
const lv_font_t lv_font_montserrat_8¶
-
const lv_font_t lv_font_montserrat_10¶
-
const lv_font_t lv_font_montserrat_12¶
-
const lv_font_t lv_font_montserrat_14¶
-
const lv_font_t lv_font_montserrat_16¶
-
const lv_font_t lv_font_montserrat_18¶
-
const lv_font_t lv_font_montserrat_20¶
-
const lv_font_t lv_font_montserrat_22¶
-
const lv_font_t lv_font_montserrat_24¶
-
const lv_font_t lv_font_montserrat_26¶
-
const lv_font_t lv_font_montserrat_28¶
-
const lv_font_t lv_font_montserrat_30¶
-
const lv_font_t lv_font_montserrat_32¶
-
const lv_font_t lv_font_montserrat_34¶
-
const lv_font_t lv_font_montserrat_36¶
-
const lv_font_t lv_font_montserrat_38¶
-
const lv_font_t lv_font_montserrat_40¶
-
const lv_font_t lv_font_montserrat_42¶
-
const lv_font_t lv_font_montserrat_44¶
-
const lv_font_t lv_font_montserrat_46¶
-
const lv_font_t lv_font_montserrat_48¶
-
const lv_font_t lv_font_montserrat_28_compressed¶
-
const lv_font_t lv_font_dejavu_16_persian_hebrew¶
-
const lv_font_t lv_font_source_han_sans_sc_14_cjk¶
-
const lv_font_t lv_font_source_han_sans_sc_16_cjk¶
-
const lv_font_t lv_font_unscii_8¶
-
const lv_font_t lv_font_unscii_16¶
-
struct lv_font_glyph_dsc_t¶
- #include <lv_font.h>
Describes the properties of a glyph.
Public Members
-
const lv_font_t *resolved_font¶
Pointer to a font where the glyph was actually found after handling fallbacks
-
uint16_t adv_w¶
The glyph needs this space. Draw the next glyph after this width.
-
uint16_t box_w¶
Width of the glyph's bounding box
-
uint16_t box_h¶
Height of the glyph's bounding box
-
int16_t ofs_x¶
x offset of the bounding box
-
int16_t ofs_y¶
y offset of the bounding box
-
uint16_t stride¶
Bytes in each line. If 0 than there is no padding at the end of the line.
-
lv_font_glyph_format_t format¶
Font format of the glyph see lv_font_glyph_format_t
-
uint8_t is_placeholder¶
Glyph is missing. But placeholder will still be displayed
-
uint8_t req_raw_bitmap¶
0: Get bitmap should return an A8 or ARGB8888 image. 1: return the bitmap as it is (Maybe A1/2/4 or any proprietary formats).
-
int32_t outline_stroke_width¶
used with freetype vector fonts - width of the letter outline
-
uint32_t index¶
Unicode code point
-
const void *src¶
Pointer to the source data used by image fonts
-
union lv_font_glyph_dsc_t gid¶
The index of the glyph in the font file. Used by the font cache
-
lv_cache_entry_t *entry¶
The cache entry of the glyph draw data. Used by the font cache
-
const lv_font_t *resolved_font¶
-
struct _lv_font_t¶
- #include <lv_font.h>
Describe the properties of a font
Public Members
-
bool (*get_glyph_dsc)(const lv_font_t*, lv_font_glyph_dsc_t*, uint32_t letter, uint32_t letter_next)¶
Get a glyph's descriptor from a font
-
const void *(*get_glyph_bitmap)(lv_font_glyph_dsc_t*, lv_draw_buf_t*)¶
Get a glyph's bitmap from a font
-
void (*release_glyph)(const lv_font_t*, lv_font_glyph_dsc_t*)¶
Release a glyph
-
int32_t line_height¶
The real line height where any text fits
-
int32_t base_line¶
Base line measured from the bottom of the line_height
-
uint8_t subpx¶
An element of
lv_font_subpx_t
-
uint8_t kerning¶
An element of
lv_font_kerning_t
-
uint8_t static_bitmap¶
The font will be used as static bitmap
-
int8_t underline_position¶
Distance between the top of the underline and base line (< 0 means below the base line)
-
int8_t underline_thickness¶
Thickness of the underline
-
const void *dsc¶
Store implementation specific or run_time data or caching here
-
const lv_font_t *fallback¶
Fallback font for missing glyph. Resolved recursively
-
void *user_data¶
Custom user data for font.
-
bool (*get_glyph_dsc)(const lv_font_t*, lv_font_glyph_dsc_t*, uint32_t letter, uint32_t letter_next)¶
-
struct _lv_font_class_t¶
Public Members
-
lv_font_t *(*create_cb)(const lv_font_info_t *info, const void *src)¶
Font creation callback function
-
void (*delete_cb)(lv_font_t *font)¶
Font deletion callback function
-
void *(*dup_src_cb)(const void *src)¶
Font source duplication callback function
-
void (*free_src_cb)(void *src)¶
Font source free callback function
-
lv_font_t *(*create_cb)(const lv_font_info_t *info, const void *src)¶
-
struct _lv_font_info_t¶
Public Members
-
const char *name¶
Font name, used to distinguish different font resources
-
const lv_font_class_t *class_p¶
Font backend implementation
-
uint32_t size¶
Font size in pixel
-
uint32_t render_mode¶
Font rendering mode, see
lv_freetype_font_render_mode_t
-
uint32_t style¶
Font style, see
lv_freetype_font_style_t
-
lv_font_kerning_t kerning¶
Font kerning, see
lv_font_kerning_t
-
const char *name¶