diff options
author | Youngbok Shin <youngb.shin@samsung.com> | 2016-08-18 14:39:40 +0300 |
---|---|---|
committer | Daniel Hirt <daniel.hirt@samsung.com> | 2016-08-18 14:39:41 +0300 |
commit | 36d086ec42feabe2b5c868897897c6a9e0460978 (patch) | |
tree | 2d39287dccb623b2392ed18e305c2825009d899c | |
parent | b915d29cd1e0b1091a6f6eb066188c65987de280 (diff) | |
download | efl-36d086ec42feabe2b5c868897897c6a9e0460978.tar.gz |
Evas text: fix RTL text ellipsis issues
Summary:
Visual position of ellipsis item should be set according to
its bidi direction. But, by setting visual position in same way
as logical position, the end ellipsis could be put opposite side.
Also, start ellipsis must placed on left side of RTL text.
@fix T3187
Test Plan: Test an sample on T3187
Reviewers: tasn, woohyun, herdsman
Subscribers: raster, Blackmole, z-wony, cedric, jpeg, minudf
Maniphest Tasks: T3187
Differential Revision: https://phab.enlightenment.org/D3769
-rw-r--r-- | src/lib/evas/canvas/evas_object_text.c | 28 |
1 files changed, 20 insertions, 8 deletions
diff --git a/src/lib/evas/canvas/evas_object_text.c b/src/lib/evas/canvas/evas_object_text.c index b5c79a221a..4aa29c82a2 100644 --- a/src/lib/evas/canvas/evas_object_text.c +++ b/src/lib/evas/canvas/evas_object_text.c @@ -890,25 +890,32 @@ _evas_object_text_layout(Evas_Object *eo_obj, Evas_Text_Data *o, Eina_Unicode *t } if (itr && (itr != start_ellip_it)) { - int cut = 1 + ENFN->font_last_up_to_pos(ENDT, + int cut = ENFN->font_last_up_to_pos(ENDT, o->font, &itr->text_props, ellipsis_coord - (advance + l + r), 0); - if (cut > 0) + if (cut >= 0) { - start_ellip_it->text_pos = itr->text_pos; - start_ellip_it->visual_pos = itr->visual_pos; - if (!_layout_text_item_trim(obj, o, itr, cut, EINA_FALSE)) + + if (itr->text_props.bidi_dir == EVAS_BIDI_DIRECTION_RTL) + start_ellip_it->visual_pos = itr->visual_pos + cut + 1; + else + start_ellip_it->visual_pos = itr->visual_pos; + + if (!_layout_text_item_trim(obj, o, itr, cut + 1, EINA_FALSE)) { _evas_object_text_item_del(o, itr); } } } - o->items = (Evas_Object_Text_Item *) eina_inlist_remove(EINA_INLIST_GET(o->items), EINA_INLIST_GET(start_ellip_it)); - o->items = (Evas_Object_Text_Item *) eina_inlist_prepend(EINA_INLIST_GET(o->items), EINA_INLIST_GET(start_ellip_it)); + if (!o->bidi_par_props) + { + o->items = (Evas_Object_Text_Item *) eina_inlist_remove(EINA_INLIST_GET(o->items), EINA_INLIST_GET(start_ellip_it)); + o->items = (Evas_Object_Text_Item *) eina_inlist_prepend(EINA_INLIST_GET(o->items), EINA_INLIST_GET(start_ellip_it)); + } } if (end_ellip_it) @@ -946,7 +953,12 @@ _evas_object_text_layout(Evas_Object *eo_obj, Evas_Text_Data *o, Eina_Unicode *t if (cut >= 0) { end_ellip_it->text_pos = itr->text_pos + cut; - end_ellip_it->visual_pos = itr->visual_pos + cut; + + if (itr->text_props.bidi_dir == EVAS_BIDI_DIRECTION_RTL) + end_ellip_it->visual_pos = itr->visual_pos - 1; + else + end_ellip_it->visual_pos = itr->visual_pos + cut; + if (_layout_text_item_trim(obj, o, itr, cut, EINA_TRUE)) { itr = (Evas_Object_Text_Item *) EINA_INLIST_GET(itr)->next; |