mirror of
https://github.com/lvgl/lvgl.git
synced 2026-05-10 04:37:55 +08:00
CJK: fix built-in SimSun font and wrong UTF-8 decoding in Arabic processor
This commit is contained in:
Binary file not shown.
Binary file not shown.
File diff suppressed because one or more lines are too long
+10472
-11085
File diff suppressed because one or more lines are too long
+21
-12
@@ -111,12 +111,14 @@ uint32_t _lv_txt_ap_calc_bytes_cnt(const char * txt)
|
||||
if(current_ap_idx != LV_UNDEF_ARABIC_PERSIAN_CHARS)
|
||||
ch_enc = ap_chars_map[current_ap_idx].char_end_form;
|
||||
|
||||
if(ch_enc <= 0x7F)
|
||||
if(ch_enc < 0x80)
|
||||
chars_cnt++;
|
||||
else if(ch_enc <= 0x7FFF)
|
||||
else if(ch_enc < 0x0800)
|
||||
chars_cnt += 2;
|
||||
else
|
||||
else if(ch_enc < 0x010000)
|
||||
chars_cnt += 3;
|
||||
else
|
||||
chars_cnt += 4;
|
||||
|
||||
i++;
|
||||
}
|
||||
@@ -176,18 +178,25 @@ void _lv_txt_ap_proc(const char * txt, char * txt_out)
|
||||
i = 0;
|
||||
|
||||
while(i < txt_length) {
|
||||
if((ch_enc[i]) <= 0x7F) {
|
||||
*(txt_out_temp++) = ch_enc[i];
|
||||
if(ch_enc[i] < 0x80) {
|
||||
*(txt_out_temp++) = ch_enc[i] & 0xFF;
|
||||
}
|
||||
else if(ch_enc[i] <= 0x7FFF) {
|
||||
*(txt_out_temp++) = 0xC0 | ((ch_enc[i] >> 6) & 0x3F);
|
||||
*(txt_out_temp++) = 0x80 | (ch_enc[i] & 0x3F);
|
||||
else if(ch_enc[i] < 0x0800) {
|
||||
*(txt_out_temp++) = ((ch_enc[i] >> 6) & 0x1F) | 0xC0;
|
||||
*(txt_out_temp++) = ((ch_enc[i] >> 0) & 0x3F) | 0x80;
|
||||
}
|
||||
else {
|
||||
*(txt_out_temp++) = 0xE0 | ((ch_enc[i] >> 12) & 0x3F);
|
||||
*(txt_out_temp++) = 0x80 | ((ch_enc[i] >> 6) & 0x3F);
|
||||
*(txt_out_temp++) = 0x80 | (ch_enc[i] & 0x3F);
|
||||
else if(ch_enc[i] < 0x010000) {
|
||||
*(txt_out_temp++) = ((ch_enc[i] >> 12) & 0x0F) | 0xE0;
|
||||
*(txt_out_temp++) = ((ch_enc[i] >> 6) & 0x3F) | 0x80;
|
||||
*(txt_out_temp++) = ((ch_enc[i] >> 0) & 0x3F) | 0x80;
|
||||
}
|
||||
else if(ch_enc[i] < 0x110000) {
|
||||
*(txt_out_temp++) = ((ch_enc[i] >> 18) & 0x07) | 0xF0;
|
||||
*(txt_out_temp++) = ((ch_enc[i] >> 12) & 0x3F) | 0x80;
|
||||
*(txt_out_temp++) = ((ch_enc[i] >> 6) & 0x3F) | 0x80;
|
||||
*(txt_out_temp++) = ((ch_enc[i] >> 0) & 0x3F) | 0x80;
|
||||
}
|
||||
|
||||
i++;
|
||||
}
|
||||
*(txt_out_temp) = '\0';
|
||||
|
||||
Reference in New Issue
Block a user