mirror of
https://github.com/lvgl/lvgl.git
synced 2025-01-14 06:42:58 +08:00
fix(bidi): add weak characters to the previous strong character's run (#2777)
* fix some errors in bidi algorithm when displaying arabic * fix some errors in bidi algorithm when displaying arabic * fix format error Co-authored-by: liuxinh <liuxinh@landicorp.com>
This commit is contained in:
parent
7e2e25a9d6
commit
9113b9d4fb
@ -440,10 +440,13 @@ static lv_base_dir_t get_next_run(const char * txt, lv_base_dir_t base_dir, uint
|
||||
/*Find the first strong char. Skip the neutrals*/
|
||||
while(dir == LV_BASE_DIR_NEUTRAL || dir == LV_BASE_DIR_WEAK) {
|
||||
letter = _lv_txt_encoded_next(txt, &i);
|
||||
|
||||
pos_conv_i++;
|
||||
dir = lv_bidi_get_letter_dir(letter);
|
||||
if(dir == LV_BASE_DIR_NEUTRAL) dir = bracket_process(txt, i, max_len, letter, base_dir);
|
||||
|
||||
if(dir==LV_BASE_DIR_LTR || dir==LV_BASE_DIR_RTL) break;
|
||||
|
||||
if(i >= max_len || txt[i] == '\0' || txt[i] == '\n' || txt[i] == '\r') {
|
||||
*len = i;
|
||||
*pos_conv_len = pos_conv_i;
|
||||
@ -466,6 +469,14 @@ static lv_base_dir_t get_next_run(const char * txt, lv_base_dir_t base_dir, uint
|
||||
next_dir = lv_bidi_get_letter_dir(letter);
|
||||
if(next_dir == LV_BASE_DIR_NEUTRAL) next_dir = bracket_process(txt, i, max_len, letter, base_dir);
|
||||
|
||||
if(next_dir == LV_BASE_DIR_WEAK){
|
||||
if(run_dir == LV_BASE_DIR_RTL){
|
||||
if(base_dir == LV_BASE_DIR_RTL){
|
||||
next_dir = LV_BASE_DIR_LTR;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*New dir found?*/
|
||||
if((next_dir == LV_BASE_DIR_RTL || next_dir == LV_BASE_DIR_LTR) && next_dir != run_dir) {
|
||||
/*Include neutrals if `run_dir == base_dir`*/
|
||||
|
Loading…
x
Reference in New Issue
Block a user