lv_text.h

Defines

LV_TXT_ENC_UTF8
LV_TXT_ENC_ASCII
LV_TEXT_LEN_MAX

Enums

enum lv_text_flag_t

Options for text rendering.

Values:

enumerator LV_TEXT_FLAG_NONE
enumerator LV_TEXT_FLAG_EXPAND
enumerator LV_TEXT_FLAG_FIT

Max-width is already equal to the longest line. (Used to skip some calculation)

enumerator LV_TEXT_FLAG_BREAK_ALL

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.

enumerator LV_TEXT_FLAG_RECOLOR

Enable parsing of recolor command

enum lv_text_align_t

Label align policy

Values:

enumerator LV_TEXT_ALIGN_AUTO

Align text auto

enumerator LV_TEXT_ALIGN_LEFT

Align text to left

enumerator LV_TEXT_ALIGN_CENTER

Align text to center

enumerator LV_TEXT_ALIGN_RIGHT

Align text to right

enum lv_text_cmd_state_t

State machine for text renderer.

Values:

enumerator LV_TEXT_CMD_STATE_WAIT

Waiting for command

enumerator LV_TEXT_CMD_STATE_PAR

Processing the parameter

enumerator LV_TEXT_CMD_STATE_IN

Processing the command

Functions

void lv_text_attributes_init(lv_text_attributes_t *attributes)

Initialize the text attributes descriptor

Parameters:

attributes – the text attributes descriptor to initialize

void lv_text_get_size(lv_point_t *size_res, const char *text, const lv_font_t *font, lv_text_attributes_t *attributes)

Get size of a text

Parameters:
  • size_res – pointer to a 'point_t' variable to store the result

  • text – pointer to a text

  • font – pointer to font of the text

  • attributes – the text attributes, flags for line break behaviour, spacing etc

struct lv_text_attributes_t

Public Members

int32_t letter_space

Letter space between letters

int32_t line_space

Space between lines of text

int32_t max_width

Max width of the text (break the lines to fit this size). Set COORD_MAX to avoid

lv_text_flag_t text_flags