diff --git a/CHANGELOG.md b/CHANGELOG.md index 1646b9cf7..11df6b1ec 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -12,6 +12,8 @@ - fix(indev) disabled object shouldn't absorb clicks but let the parent to be clicked - fix(arabic) support processing again already processed texts with _lv_txt_ap_proc - fix(textarea) support Arabic letter connections +- fix(dropdown) support Arabic letter connections +- fix(value_str) support Arabic letter connections in value string property ## v7.7.2 (Planned to 17.11.2020) ### Bugfixes diff --git a/src/lv_draw/lv_draw_rect.c b/src/lv_draw/lv_draw_rect.c index 4d41d4405..2710db162 100644 --- a/src/lv_draw/lv_draw_rect.c +++ b/src/lv_draw/lv_draw_rect.c @@ -10,6 +10,7 @@ #include "lv_draw_blend.h" #include "lv_draw_mask.h" #include "../lv_misc/lv_math.h" +#include "../lv_misc/lv_txt_ap.h" #include "../lv_core/lv_refr.h" #include "../lv_misc/lv_debug.h" @@ -1295,8 +1296,16 @@ static void draw_value_str(const lv_area_t * coords, const lv_area_t * clip, con if(dsc->value_str == NULL) return; if(dsc->value_opa <= LV_OPA_MIN) return; +#if LV_USE_ARABIC_PERSIAN_CHARS == 0 + const char * str = dsc->value_str; +#else + uint32_t str_len = _lv_txt_ap_calc_bytes_cnt(dsc->value_str); + char * str = _lv_mem_buf_get(str_len + 1); + _lv_txt_ap_proc(dsc->value_str, str); +#endif + lv_point_t s; - _lv_txt_get_size(&s, dsc->value_str, dsc->value_font, dsc->value_letter_space, dsc->value_line_space, LV_COORD_MAX, + _lv_txt_get_size(&s, str, dsc->value_font, dsc->value_letter_space, dsc->value_line_space, LV_COORD_MAX, LV_TXT_FLAG_NONE); lv_area_t value_area; @@ -1321,7 +1330,7 @@ static void draw_value_str(const lv_area_t * coords, const lv_area_t * clip, con label_dsc.color = dsc->value_color; label_dsc.opa = dsc->value_opa; - lv_draw_label(&value_area, clip, &label_dsc, dsc->value_str, NULL); + lv_draw_label(&value_area, clip, &label_dsc, str, NULL); } #endif diff --git a/src/lv_widgets/lv_dropdown.c b/src/lv_widgets/lv_dropdown.c index b8247f72e..a73524570 100644 --- a/src/lv_widgets/lv_dropdown.c +++ b/src/lv_widgets/lv_dropdown.c @@ -18,6 +18,7 @@ #include "../lv_font/lv_symbol_def.h" #include "../lv_misc/lv_anim.h" #include "../lv_misc/lv_math.h" +#include "../lv_misc/lv_txt_ap.h" #include /********************* @@ -211,7 +212,12 @@ void lv_dropdown_set_options(lv_obj_t * ddlist, const char * options) ext->sel_opt_id_orig = 0; /*Allocate space for the new text*/ +#if LV_USE_ARABIC_PERSIAN_CHARS == 0 size_t len = strlen(options) + 1; +#else + size_t len = _lv_txt_ap_calc_bytes_cnt(options) + 1; +#endif + if(ext->options != NULL && ext->static_txt == 0) { lv_mem_free(ext->options); ext->options = NULL; @@ -222,7 +228,11 @@ void lv_dropdown_set_options(lv_obj_t * ddlist, const char * options) LV_ASSERT_MEM(ext->options); if(ext->options == NULL) return; +#if LV_USE_ARABIC_PERSIAN_CHARS == 0 strcpy(ext->options, options); +#else + _lv_txt_ap_proc(options, ext->options); +#endif /*Now the text is dynamically allocated*/ ext->static_txt = 0;