lv_bidi.h

Defines

LV_BIDI_LRO
LV_BIDI_RLO

Typedefs

typedef _lv_base_dir_t lv_base_dir_t

Enums

enum _lv_base_dir_t

Values:

enumerator LV_BASE_DIR_LTR
enumerator LV_BASE_DIR_RTL
enumerator LV_BASE_DIR_AUTO
enumerator LV_BASE_DIR_NEUTRAL
enumerator LV_BASE_DIR_WEAK

Functions

void _lv_bidi_process(const char *str_in, char *str_out, lv_base_dir_t base_dir)

Convert a text to get the characters in the correct visual order according to Unicode Bidirectional Algorithm

Parameters:
  • str_in -- the text to process

  • str_out -- store the result here. Has the be strlen(str_in) length

  • base_dir -- LV_BASE_DIR_LTR or LV_BASE_DIR_RTL

lv_base_dir_t _lv_bidi_detect_base_dir(const char *txt)

Auto-detect the direction of a text based on the first strong character

Parameters:

txt -- the text to process

Returns:

LV_BASE_DIR_LTR or LV_BASE_DIR_RTL

uint16_t _lv_bidi_get_logical_pos(const char *str_in, char **bidi_txt, uint32_t len, lv_base_dir_t base_dir, uint32_t visual_pos, bool *is_rtl)

Get the logical position of a character in a line

Parameters:
  • str_in -- the input string. Can be only one line.

  • bidi_txt -- internally the text is bidi processed which buffer can be get here. If not required anymore has to freed with lv_free() Can be NULL is unused

  • len -- length of the line in character count

  • base_dir -- base direction of the text: LV_BASE_DIR_LTR or LV_BASE_DIR_RTL

  • visual_pos -- the visual character position which logical position should be get

  • is_rtl -- tell the char at visual_pos is RTL or LTR context

Returns:

the logical character position

uint16_t _lv_bidi_get_visual_pos(const char *str_in, char **bidi_txt, uint16_t len, lv_base_dir_t base_dir, uint32_t logical_pos, bool *is_rtl)

Get the visual position of a character in a line

Parameters:
  • str_in -- the input string. Can be only one line.

  • bidi_txt -- internally the text is bidi processed which buffer can be get here. If not required anymore has to freed with lv_free() Can be NULL is unused

  • len -- length of the line in character count

  • base_dir -- base direction of the text: LV_BASE_DIR_LTR or LV_BASE_DIR_RTL

  • logical_pos -- the logical character position which visual position should be get

  • is_rtl -- tell the char at logical_pos is RTL or LTR context

Returns:

the visual character position

void _lv_bidi_process_paragraph(const char *str_in, char *str_out, uint32_t len, lv_base_dir_t base_dir, uint16_t *pos_conv_out, uint16_t pos_conv_len)

Bidi process a paragraph of text

Parameters:
  • str_in -- the string to process

  • str_out -- store the result here

  • len -- length of the text

  • base_dir -- base dir of the text

  • pos_conv_out -- an uint16_t array to store the related logical position of the character. Can be NULL is unused

  • pos_conv_len -- length of pos_conv_out in element count

void lv_bidi_calculate_align(lv_text_align_t *align, lv_base_dir_t *base_dir, const char *txt)

Get the real text alignment from the a text alignment, base direction and a text.

Parameters:
  • align -- LV_TEXT_ALIGN_..., write back the calculated align here (LV_TEXT_ALIGN_LEFT/RIGHT/CENTER)

  • base_dir -- LV_BASE_DIR_..., write the calculated base dir here (LV_BASE_DIR_LTR/RTL)

  • txt -- a text, used with LV_BASE_DIR_AUTO to determine the base direction

void lv_bidi_set_custom_neutrals_static(const char *neutrals)

Set custom neutrals string

Parameters:

neutrals -- default " \t\n\r.,:;'\"`!?%/\-=()[]{}<>#&$|"