lv_draw_label.h

Defines

LV_DRAW_LABEL_NO_TXT_SEL

Typedefs

typedef void (*lv_draw_glyph_cb_t)(lv_draw_task_t *t, lv_draw_glyph_dsc_t *dsc, lv_draw_fill_dsc_t *fill_dsc, const lv_area_t *fill_area)

Passed as a parameter to lv_draw_label_iterate_characters to draw the characters one by one

Param t:

pointer to a draw task

Param dsc:

pointer to lv_draw_glyph_dsc_t to describe the character to draw if NULL don't draw character

Param fill_dsc:

pointer to a fill descriptor to draw a background for the character or underline or strike through if NULL do not fill anything

Param fill_area:

the area to fill if NULL do not fill anything

Functions

void lv_draw_letter_dsc_init(lv_draw_letter_dsc_t *dsc)
void lv_draw_label_dsc_init(lv_draw_label_dsc_t *dsc)

Initialize a label draw descriptor

Parameters:

dsc – pointer to a draw descriptor

lv_draw_label_dsc_t *lv_draw_task_get_label_dsc(lv_draw_task_t *task)

Try to get a label draw descriptor from a draw task.

Parameters:

task – draw task

Returns:

the task's draw descriptor or NULL if the task is not of type LV_DRAW_TASK_TYPE_LABEL

void lv_draw_glyph_dsc_init(lv_draw_glyph_dsc_t *dsc)

Initialize a glyph draw descriptor. Used internally.

Parameters:

dsc – pointer to a draw descriptor

void lv_draw_label(lv_layer_t *layer, const lv_draw_label_dsc_t *dsc, const lv_area_t *coords)

Create a draw task to render a text

Parameters:
  • layer – pointer to a layer

  • dsc – pointer to draw descriptor

  • coords – coordinates of the character

void lv_draw_character(lv_layer_t *layer, lv_draw_label_dsc_t *dsc, const lv_point_t *point, uint32_t unicode_letter)

Create a draw task to render a single character

Parameters:
  • layer – pointer to a layer

  • dsc – pointer to draw descriptor

  • point – position of the label

  • unicode_letter – the letter to draw

void lv_draw_letter(lv_layer_t *layer, lv_draw_letter_dsc_t *dsc, const lv_point_t *point)

Draw a single letter

Parameters:
  • layer – pointer to a layer

  • dsc – pointer to draw descriptor

  • point – position of the label

void lv_draw_label_iterate_characters(lv_draw_task_t *t, const lv_draw_label_dsc_t *dsc, const lv_area_t *coords, lv_draw_glyph_cb_t cb)

Should be used during rendering the characters to get the position and other parameters of the characters

Parameters:
  • t – pointer to a draw task

  • dsc – pointer to draw descriptor

  • coords – coordinates of the label

  • cb – a callback to call to draw each glyphs one by one

void lv_draw_unit_draw_letter(lv_draw_task_t *t, lv_draw_glyph_dsc_t *dsc, const lv_point_t *pos, const lv_font_t *font, uint32_t letter, lv_draw_glyph_cb_t cb)

Draw a single letter using the provided draw unit, glyph descriptor, position, font, and callback.

This function is responsible for rendering a single character from a text string, applying the necessary styling described by the glyph descriptor (dsc). It handles the retrieval of the glyph's description, checks its visibility within the clipping area, and invokes the callback (cb) to render the glyph at the specified position (pos) using the given font (font).

Parameters:
  • t – Pointer to the drawing task.

  • dsc – Pointer to the descriptor containing styling for the glyph to be drawn.

  • pos – Pointer to the point coordinates where the letter should be drawn.

  • font – Pointer to the font containing the glyph.

  • letter – The Unicode code point of the letter to be drawn.

  • cb – Callback function to execute the actual rendering of the glyph.

struct lv_draw_label_dsc_t

Public Members

lv_draw_dsc_base_t base
const char *text
uint32_t text_length
const lv_font_t *font
uint32_t sel_start
uint32_t sel_end
lv_color_t color
lv_color_t sel_color
lv_color_t sel_bg_color
int32_t line_space
int32_t letter_space
int32_t ofs_x
int32_t ofs_y
int32_t rotation
lv_opa_t opa
lv_base_dir_t bidi_dir
lv_text_align_t align
lv_text_flag_t flag
lv_text_decor_t decor
lv_blend_mode_t blend_mode
uint8_t text_local

< 1: malloc buffer and copy text there. 0: text is const and it's pointer will be valid during rendering.

uint8_t text_static

Indicate that the text is constant and its pointer can be safely saved e.g. in a cache.

uint8_t has_bided

1: already executed lv_bidi_process_paragraph. 0: has not been executed lv_bidi_process_paragraph.

lv_draw_label_hint_t *hint
struct lv_draw_letter_dsc_t

Public Members

lv_draw_dsc_base_t base
uint32_t unicode
const lv_font_t *font
lv_color_t color
int32_t rotation
int32_t scale_x
int32_t scale_y
int32_t skew_x
int32_t skew_y
lv_point_t pivot
lv_opa_t opa
lv_text_decor_t decor
lv_blend_mode_t blend_mode