1 /** 2 * @file lv_bidi_private.h 3 * 4 */ 5 6 #ifndef LV_BIDI_PRIVATE_H 7 #define LV_BIDI_PRIVATE_H 8 9 #ifdef __cplusplus 10 extern "C" { 11 #endif 12 13 /********************* 14 * INCLUDES 15 *********************/ 16 17 #include "lv_bidi.h" 18 #if LV_USE_BIDI 19 20 /********************* 21 * DEFINES 22 *********************/ 23 24 /********************** 25 * TYPEDEFS 26 **********************/ 27 28 /********************** 29 * GLOBAL PROTOTYPES 30 **********************/ 31 32 /** 33 * Convert a text to get the characters in the correct visual order according to 34 * Unicode Bidirectional Algorithm 35 * @param str_in the text to process 36 * @param str_out store the result here. Has the be `strlen(str_in)` length 37 * @param base_dir `LV_BASE_DIR_LTR` or `LV_BASE_DIR_RTL` 38 */ 39 void lv_bidi_process(const char * str_in, char * str_out, lv_base_dir_t base_dir); 40 41 /** 42 * Auto-detect the direction of a text based on the first strong character 43 * @param txt the text to process 44 * @return `LV_BASE_DIR_LTR` or `LV_BASE_DIR_RTL` 45 */ 46 lv_base_dir_t lv_bidi_detect_base_dir(const char * txt); 47 48 /** 49 * Get the logical position of a character in a line 50 * @param str_in the input string. Can be only one line. 51 * @param bidi_txt internally the text is bidi processed which buffer can be get here. 52 * If not required anymore has to freed with `lv_free()` 53 * Can be `NULL` is unused 54 * @param len length of the line in character count 55 * @param base_dir base direction of the text: `LV_BASE_DIR_LTR` or `LV_BASE_DIR_RTL` 56 * @param visual_pos the visual character position which logical position should be get 57 * @param is_rtl tell the char at `visual_pos` is RTL or LTR context 58 * @return the logical character position 59 */ 60 uint16_t lv_bidi_get_logical_pos(const char * str_in, char ** bidi_txt, uint32_t len, lv_base_dir_t base_dir, 61 uint32_t visual_pos, bool * is_rtl); 62 63 /** 64 * Get the visual position of a character in a line 65 * @param str_in the input string. Can be only one line. 66 * @param bidi_txt internally the text is bidi processed which buffer can be get here. 67 * If not required anymore has to freed with `lv_free()` 68 * Can be `NULL` is unused 69 * @param len length of the line in character count 70 * @param base_dir base direction of the text: `LV_BASE_DIR_LTR` or `LV_BASE_DIR_RTL` 71 * @param logical_pos the logical character position which visual position should be get 72 * @param is_rtl tell the char at `logical_pos` is RTL or LTR context 73 * @return the visual character position 74 */ 75 uint16_t lv_bidi_get_visual_pos(const char * str_in, char ** bidi_txt, uint16_t len, lv_base_dir_t base_dir, 76 uint32_t logical_pos, bool * is_rtl); 77 78 /** 79 * Bidi process a paragraph of text 80 * @param str_in the string to process 81 * @param str_out store the result here 82 * @param len length of the text 83 * @param base_dir base dir of the text 84 * @param pos_conv_out an `uint16_t` array to store the related logical position of the character. 85 * Can be `NULL` is unused 86 * @param pos_conv_len length of `pos_conv_out` in element count 87 */ 88 void lv_bidi_process_paragraph(const char * str_in, char * str_out, uint32_t len, lv_base_dir_t base_dir, 89 uint16_t * pos_conv_out, uint16_t pos_conv_len); 90 91 /********************** 92 * MACROS 93 **********************/ 94 95 #endif /*LV_USE_BIDI*/ 96 97 #ifdef __cplusplus 98 } /*extern "C"*/ 99 #endif 100 101 #endif /*LV_BIDI_PRIVATE_H*/ 102