Skip to content

Commit

Permalink
fix(txt): skip basic arabic vowel characters when processing conjunction
Browse files Browse the repository at this point in the history
* Skips basic vowel characters when calculating arabic conjunction

* Updated CHANGELOG.md

* Update docs/CHANGELOG.md

Co-authored-by: Gabor Kiss-Vamosi <kisvegabor@gmail.com>

Co-authored-by: Gabor Kiss-Vamosi <kisvegabor@gmail.com>
  • Loading branch information
DennisSHCheung and kisvegabor committed Nov 5, 2021
1 parent 6d95521 commit 5b54800
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 0 deletions.
1 change: 1 addition & 0 deletions docs/CHANGELOG.md
Expand Up @@ -45,6 +45,7 @@
- Add support for RT-Thread RTOS
- feat(disp): add utility functions/macros for dealing with non-fullscreen displays
- fix(core): force the use of 32bit integers in the enumerations so that LVGL can be compiled on 16bit architectures
- fix(txt) skip basic arabic vowel characters when processing conjunction

## v8.0.2 (16.07.2021)
- fix(theme) improve button focus of keyboard
Expand Down
16 changes: 16 additions & 0 deletions src/misc/lv_txt_ap.c
Expand Up @@ -38,6 +38,7 @@ typedef struct {
#if LV_USE_ARABIC_PERSIAN_CHARS == 1
static uint32_t lv_ap_get_char_index(uint16_t c);
static uint32_t lv_txt_lam_alef(uint32_t ch_curr, uint32_t ch_next);
static bool lv_txt_is_arabic_vowel(uint16_t c);

/**********************
* STATIC VARIABLES
Expand Down Expand Up @@ -166,6 +167,16 @@ void _lv_txt_ap_proc(const char * txt, char * txt_out)
index_current = lv_ap_get_char_index(ch_enc[i]);
idx_next = lv_ap_get_char_index(ch_enc[i + 1]);

if(lv_txt_is_arabic_vowel(ch_enc[i])) { // Current character is a vowel
ch_fin[j] = ch_enc[i];
i++;
j++;
continue; // Skip this character
}
else if(lv_txt_is_arabic_vowel(ch_enc[i + 1])) { // Next character is a vowel
idx_next = lv_ap_get_char_index(ch_enc[i + 2]); // Skip the vowel character to join with the character after it
}

if(index_current == LV_UNDEF_ARABIC_PERSIAN_CHARS) {
ch_fin[j] = ch_enc[i];
j++;
Expand Down Expand Up @@ -282,4 +293,9 @@ static uint32_t lv_txt_lam_alef(uint32_t ch_curr, uint32_t ch_next)
return 0;
}

static bool lv_txt_is_arabic_vowel(uint16_t c)
{
return (c >= 0x064B) && (c <= 0x0652);
}

#endif

0 comments on commit 5b54800

Please sign in to comment.