tasn pushed a commit to branch master.

commit 1425b0d2dc68aea74478bc348eb44082ae7c71f1
Author: Tom Hacohen <[email protected]>
Date:   Mon Feb 25 15:39:32 2013 +0000

    Evas text: Fixed a bug with the (kinda) newly added text object ellipsis.
    
    There was a problem with bidi texts and ellipsis. The text would be trimmed
    according to the visual position instead of the logical.
---
 src/lib/evas/canvas/evas_object_text.c | 10 ++++------
 src/tests/evas/evas_test_text.c        | 36 +++++++++++++++++++++++++++-------
 2 files changed, 33 insertions(+), 13 deletions(-)

diff --git a/src/lib/evas/canvas/evas_object_text.c 
b/src/lib/evas/canvas/evas_object_text.c
index 98b3ac4..45f82d3 100644
--- a/src/lib/evas/canvas/evas_object_text.c
+++ b/src/lib/evas/canvas/evas_object_text.c
@@ -820,12 +820,11 @@ _evas_object_text_layout(Evas_Object *eo_obj, 
Evas_Object_Text *o, Eina_Unicode
                }
              if (itr && (itr != start_ellip_it))
                {
-                  int cut = 1 + ENFN->font_char_at_coords_get(ENDT,
+                  int cut = 1 + ENFN->font_last_up_to_pos(ENDT,
                         o->font,
                         &itr->text_props,
                         ellipsis_coord - advance,
-                        0,
-                        NULL, NULL, NULL, NULL);
+                        0);
                   if (cut > 0)
                     {
                        start_ellip_it->text_pos = itr->text_pos;
@@ -864,12 +863,11 @@ _evas_object_text_layout(Evas_Object *eo_obj, 
Evas_Object_Text *o, Eina_Unicode
                   /* FIXME: We shouldn't do anything. */
                }
 
-             int cut = ENFN->font_char_at_coords_get(ENDT,
+             int cut = ENFN->font_last_up_to_pos(ENDT,
                    o->font,
                    &itr->text_props,
                    ellip_frame - advance,
-                   0,
-                   NULL, NULL, NULL, NULL);
+                   0);
              if (cut >= 0)
                {
                   end_ellip_it->text_pos = itr->text_pos + cut;
diff --git a/src/tests/evas/evas_test_text.c b/src/tests/evas/evas_test_text.c
index 861849f..e0a9fad 100644
--- a/src/tests/evas/evas_test_text.c
+++ b/src/tests/evas/evas_test_text.c
@@ -166,14 +166,10 @@ START_TEST(evas_text_evas)
 }
 END_TEST
 
-START_TEST(evas_text_ellipsis)
+static void
+_test_ellipsis(Evas_Object *to, const char *buf, const char *font, 
Evas_Font_Size size, double ellipsis)
 {
-   START_TEXT_TEST();
-   const char *buf = "נסיון בלה בלה בלה בלה";
-   const char *font = TEST_FONT_NAME;
-   Evas_Font_Size size = 14;
-
-   evas_object_text_ellipsis_set(to, 0.0);
+   evas_object_text_ellipsis_set(to, ellipsis);
    evas_object_move(to, 0, 0);
    evas_object_resize(to, 500, 500);
    evas_object_text_font_set(to, font, size);
@@ -191,7 +187,33 @@ START_TEST(evas_text_ellipsis)
         /* If it's gotten way too small, it means we have an issue. */
         fail_if(w < 100);
      }
+}
+
+START_TEST(evas_text_ellipsis)
+{
+   START_TEXT_TEST();
+   const char *buf = "נסיון בלה בלה בלה בלה";
+   const char *font = TEST_FONT_NAME;
+   Evas_Font_Size size = 14;
+
+   /* Test various ellipsis types. */
+
+   /* RTL */
+   _test_ellipsis(to, buf, font, size, 0.0);
+   _test_ellipsis(to, buf, font, size, 0.5);
+   _test_ellipsis(to, buf, font, size, 1.0);
+
+   /* BiDi */
+   buf = "Test נסיון בלה בלה בלה";
+   _test_ellipsis(to, buf, font, size, 0.0);
+   _test_ellipsis(to, buf, font, size, 0.5);
+   _test_ellipsis(to, buf, font, size, 1.0);
 
+   /* LTR */
+   buf = "Test test test test test";
+   _test_ellipsis(to, buf, font, size, 0.0);
+   _test_ellipsis(to, buf, font, size, 0.5);
+   _test_ellipsis(to, buf, font, size, 1.0);
 
    END_TEXT_TEST();
 }

-- 

------------------------------------------------------------------------------
Everyone hates slow websites. So do we.
Make your web apps faster with AppDynamics
Download AppDynamics Lite for free today:
http://p.sf.net/sfu/appdyn_d2d_feb

Reply via email to