mikroSDK Reference Manual
lv_bidi.h
Go to the documentation of this file.
1
6#ifndef LV_BIDI_H
7#define LV_BIDI_H
8
9#ifdef __cplusplus
10extern "C" {
11#endif
12
13/*********************
14 * INCLUDES
15 *********************/
16#include "../lv_conf_internal.h"
17
18#include <stdbool.h>
19#include <stdint.h>
20#include "lv_txt.h"
21
22/*********************
23 * DEFINES
24 *********************/
25/*Special non printable strong characters.
26 *They can be inserted to texts to affect the run's direction*/
27#define LV_BIDI_LRO "\xE2\x80\xAD" /*U+202D*/
28#define LV_BIDI_RLO "\xE2\x80\xAE" /*U+202E*/
29
30/**********************
31 * TYPEDEFS
32 **********************/
33enum {
34 LV_BASE_DIR_LTR = 0x00,
35 LV_BASE_DIR_RTL = 0x01,
36 LV_BASE_DIR_AUTO = 0x02,
37
38 LV_BASE_DIR_NEUTRAL = 0x20,
39 LV_BASE_DIR_WEAK = 0x21,
40};
41
42typedef uint8_t lv_base_dir_t;
43
44/**********************
45 * GLOBAL PROTOTYPES
46 **********************/
47#if LV_USE_BIDI
48
56void _lv_bidi_process(const char * str_in, char * str_out, lv_base_dir_t base_dir);
57
63lv_base_dir_t _lv_bidi_detect_base_dir(const char * txt);
64
77uint16_t _lv_bidi_get_logical_pos(const char * str_in, char ** bidi_txt, uint32_t len, lv_base_dir_t base_dir,
78 uint32_t visual_pos, bool * is_rtl);
79
92uint16_t _lv_bidi_get_visual_pos(const char * str_in, char ** bidi_txt, uint16_t len, lv_base_dir_t base_dir,
93 uint32_t logical_pos, bool * is_rtl);
94
105void _lv_bidi_process_paragraph(const char * str_in, char * str_out, uint32_t len, lv_base_dir_t base_dir,
106 uint16_t * pos_conv_out, uint16_t pos_conv_len);
107
114void lv_bidi_calculate_align(lv_text_align_t * align, lv_base_dir_t * base_dir, const char * txt);
115
116
117/**********************
118 * MACROS
119 **********************/
120
121#else /*LV_USE_BIDI*/
129static inline void lv_bidi_calculate_align(lv_text_align_t * align, lv_base_dir_t * base_dir, const char * txt)
130{
131 LV_UNUSED(txt);
132 LV_UNUSED(base_dir);
133 if(*align == LV_TEXT_ALIGN_AUTO) * align = LV_TEXT_ALIGN_LEFT;
134}
135#endif /*LV_USE_BIDI*/
136
137#ifdef __cplusplus
138} /*extern "C"*/
139#endif
140
141#endif /*LV_BIDI_H*/
@ LV_TEXT_ALIGN_LEFT
Definition lv_txt.h:62
@ LV_TEXT_ALIGN_AUTO
Definition lv_txt.h:61