lv_text.h
API reference for lv_text.h
See Also: Private HeaderThis header has a companion private implementation with internal data structures.lv_text_private.h
Summary
Functions
misc/lv_text.h:96function
lv_font_get_top_trim
Get the number of pixels to trim from the top of text for a given leading-trim mode.
static int32_t lv_font_get_top_trim(const lv_font_t *font, lv_text_leading_trim_t trim)| Name | Type | Description |
|---|---|---|
font | const lv_font_t * | pointer to a font |
trim | lv_text_leading_trim_t | leading-trim mode |
Returns: int32_t — pixels to trim from the top (0 if no trimming)
misc/lv_text.h:118function
lv_font_get_bottom_trim
Get the number of pixels to trim from the bottom of text for a given leading-trim mode.
static int32_t lv_font_get_bottom_trim(const lv_font_t *font, lv_text_leading_trim_t trim)| Name | Type | Description |
|---|---|---|
font | const lv_font_t * | pointer to a font |
trim | lv_text_leading_trim_t | leading-trim mode |
Returns: int32_t — pixels to trim from the bottom (0 if no trimming)
misc/lv_text.h:140function
lv_text_get_size
Get size of a text
void lv_text_get_size(lv_point_t *size_res, const char *text, const lv_font_t *font, int32_t letter_space, int32_t line_space, int32_t max_width, lv_text_flag_t flag)| Name | Type | Description |
|---|---|---|
size_res | lv_point_t * | pointer to a 'point_t' variable to store the result |
text | const char * | pointer to a text |
font | const lv_font_t * | pointer to font of the text |
letter_space | int32_t | letter space of the text |
line_space | int32_t | line space of the text |
max_width | int32_t | max width of the text (break the lines to fit this size). Set COORD_MAX to avoid |
flag | lv_text_flag_t | settings for the text from lv_text_flag_t |
Enums
lv_text_flag_t
Options for text rendering.
| Name | Value | Description |
|---|---|---|
LV_TEXT_FLAG_NONE | 0x00 | |
LV_TEXT_FLAG_EXPAND | 0x01 | Ignore max-width to avoid automatic word wrapping |
LV_TEXT_FLAG_FIT | 0x02 | Max-width is already equal to the longest line. (Used to skip some calculation) |
LV_TEXT_FLAG_BREAK_ALL | 0x04 | To prevent overflow, insert breaks between any two characters. Otherwise breaks are inserted at word boundaries, as configured via LV_TXT_BREAK_CHARS or according to LV_TXT_LINE_BREAK_LONG_LEN, LV_TXT_LINE_BREAK_LONG_PRE_MIN_LEN, and LV_TXT_LINE_BREAK_LONG_POST_MIN_LEN. |
LV_TEXT_FLAG_RECOLOR | 0x08 | Enable parsing of recolor command |
Used by 1 function
lv_text_get_size— paramflag
lv_text_align_t
Label align policy
| Name | Description |
|---|---|
LV_TEXT_ALIGN_AUTO | Align text auto |
LV_TEXT_ALIGN_LEFT | Align text to left |
LV_TEXT_ALIGN_CENTER | Align text to center |
LV_TEXT_ALIGN_RIGHT | Align text to right |
Used by 5 functions
lv_obj_set_style_text_align— paramvaluelv_bidi_calculate_align— paramalignlv_style_set_text_align— paramvaluelv_spangroup_set_align— paramalignlv_textarea_set_align— paramalign
lv_text_leading_trim_t
Text leading trim mode (similar to CSS text-box-trim / text-box-edge) using more intuitive naming. See https://developer.mozilla.org/en-US/docs/Web/CSS/Reference/Properties/text-box-edge
| Name | Value | Description |
|---|---|---|
LV_TEXT_LEADING_TRIM_NONE | 0 | No trimming (default behavior) |
LV_TEXT_LEADING_TRIM_CAPITAL_BASELINE | Trim to the top of the capital letters (cap height) and the bottom to the (alphabetic) baseline | |
LV_TEXT_LEADING_TRIM_LOWER_BASELINE | Trim to the top of the lower case letters (x-height) and the bottom to the (alphabetic) baseline Trim only the top to the height of the capital letters (cap-height) | |
LV_TEXT_LEADING_TRIM_CAPITAL | Trim only the top to the height of the lower case letters (x-height) | |
LV_TEXT_LEADING_TRIM_LOWER |
Used by 4 functions
lv_obj_set_style_text_leading_trim— paramvaluelv_style_set_text_leading_trim— paramvaluelv_font_get_top_trim— paramtrimlv_font_get_bottom_trim— paramtrim
Dependencies
How is this guide?
Last updated on