Evas text: fix RTL text ellipsis issues 95/69795/1
authorYoungbok Shin <youngb.shin@samsung.com>
Tue, 17 May 2016 01:15:59 +0000 (10:15 +0900)
committerYoungbok Shin <youngb.shin@samsung.com>
Tue, 17 May 2016 01:15:59 +0000 (10:15 +0900)
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, herdsman, woohyun

Subscribers: cedric, jpeg, minudf

Maniphest Tasks: T3187

Differential Revision: https://phab.enlightenment.org/D3769

@tizen_fix

Change-Id: If78b6becb5059052ddae23f7dee39d91ddce38c7

src/lib/evas/canvas/evas_object_text.c

index 65453d9..6005344 100644 (file)
@@ -880,25 +880,52 @@ _evas_object_text_layout(Evas_Object *eo_obj, Evas_Text_Data *o, Eina_Unicode *t
                }
              if (itr && (itr != start_ellip_it))
                {
+                  /* TIZEN_ONLY(20160517): fix RTL text ellipsis issues
                   int cut = 1 + ENFN->font_last_up_to_pos(ENDT,
                         o->font,
                         &itr->text_props,
                         ellipsis_coord - (advance + l + r),
                         0);
                   if (cut > 0)
+                   */
+                  int cut = ENFN->font_last_up_to_pos(ENDT,
+                        o->font,
+                        &itr->text_props,
+                        ellipsis_coord - (advance + l + r),
+                        0);
+                  if (cut >= 0)
+                  /* END */
                     {
 
                        start_ellip_it->text_pos = itr->text_pos;
+                       /* TIZEN_ONLY(20160517): fix RTL text ellipsis issues
                        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))
+                       /* END */
                          {
                             _evas_object_text_item_del(o, itr);
                          }
                     }
                }
 
+             /* TIZEN_ONLY(20160517): fix RTL text ellipsis issues
              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));
+               }
+             /* END */
           }
 
         if (end_ellip_it)
@@ -936,7 +963,15 @@ _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;
+                       /* TIZEN_ONLY(20160517): fix RTL text ellipsis issues
                        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;
+                       /* END */
                        if (_layout_text_item_trim(obj, o, itr, cut, EINA_TRUE))
                          {
                             itr = (Evas_Object_Text_Item *) EINA_INLIST_GET(itr)->next;