From 2683733b109335189252ab8e9083bccbdf0a12cf Mon Sep 17 00:00:00 2001 From: "Minwoo, Lee" Date: Tue, 29 Nov 2016 19:51:35 +0900 Subject: [PATCH] Evas Text: Fix width of BiDi text Summary: BiDi text is truncated because the way we find the last visual item in text object is wrong. This patch is similar with _line_native_last_visual_get function in textblock. Reviewers: cedric, tasn, herdsman Subscribers: id213sin, cedric, jpeg Differential Revision: https://phab.enlightenment.org/D3947 (commit id: d22850848dc91eccc1995eb0a5e873fc27430d32) Signed-off-by: Minwoo, Lee Change-Id: Iec239ad7edad9eb688a7430dd4384842093efaa2 --- src/lib/evas/canvas/evas_object_text.c | 23 +++++++++++++++++++++-- 1 file changed, 21 insertions(+), 2 deletions(-) diff --git a/src/lib/evas/canvas/evas_object_text.c b/src/lib/evas/canvas/evas_object_text.c index 5e55f9f..3c7ae27 100644 --- a/src/lib/evas/canvas/evas_object_text.c +++ b/src/lib/evas/canvas/evas_object_text.c @@ -699,6 +699,7 @@ _evas_object_text_layout(Evas_Object *eo_obj, Evas_Text_Data *o, Eina_Unicode *t #ifdef BIDI_SUPPORT int par_len = len; int *segment_idxs = NULL; + Eina_Bool is_bidi = EINA_FALSE; #endif if (o->items && @@ -749,6 +750,7 @@ _evas_object_text_layout(Evas_Object *eo_obj, Evas_Text_Data *o, Eina_Unicode *t } o->bidi_par_props = evas_bidi_paragraph_props_get(text, len, segment_idxs, bidi_par_type); + is_bidi = !!o->bidi_par_props; } if (o->bidi_par_props) @@ -762,6 +764,9 @@ _evas_object_text_layout(Evas_Object *eo_obj, Evas_Text_Data *o, Eina_Unicode *t if (text) { const Evas_Object_Text_Item *last_it = NULL; +#ifdef BIDI_SUPPORT + size_t max_vpos = 0; +#endif while (len > 0) { @@ -803,11 +808,25 @@ _evas_object_text_layout(Evas_Object *eo_obj, Evas_Text_Data *o, Eina_Unicode *t /* TIZEN_ONLY(20161007): Apply the last character's advance for width calculation if (it->w > 0) - last_it = it; */ if ((it->w > 0) || (it->adv > 0)) - last_it = it; /* END */ + { +#ifdef BIDI_SUPPORT + if (is_bidi) + { + if (!last_it || (visual_pos >= max_vpos)) + { + last_it = it; + max_vpos = visual_pos; + } + } + else +#endif + { + last_it = it; + } + } } } -- 2.7.4