Evas font: Fixed a bug with cluster sizes and ligatures.
authorTom Hacohen <tom@stosb.com>
Mon, 8 Apr 2013 12:30:31 +0000 (13:30 +0100)
committerTom Hacohen <tom@stosb.com>
Mon, 8 Apr 2013 12:31:09 +0000 (13:31 +0100)
This casused cursor position (among other things) to look wrong with texts
ending with ligatures.

Thanks to Yakov Goldberg for reporting.

ChangeLog
NEWS
src/lib/evas/common/evas_font_ot.c
src/tests/evas/evas_test_textblock.c

index 4c3e158..f9734d0 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2013-04-08  Tom Hacohen
+
+        * Evas font: Fix a bug with cluster size calculation with texts ending
+       with ligatures.
+
 2013-04-08  Carsten Haitzler (The Rasterman)
 
         * Evas: Add control API for multiple outputs (non-functional).
diff --git a/NEWS b/NEWS
index 2bbfecd..de6a308 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -225,3 +225,5 @@ Fixes:
     * Evas font: If OS/2 table is available and the font is demi-bold, don't do runtime emboldment.
     * Evas font: fix font source have wrong current size.
     * Evas: Fix over redrawing of Evas_Map when applied on smart object.
+    * Evas font: Fix a bug with cluster size calculation with texts ending
+       with ligatures.
index da563e0..0024376 100644 (file)
@@ -166,7 +166,7 @@ evas_common_font_ot_cluster_size_get(const Evas_Text_Props *props, size_t char_i
      }
    else
      {
-        if (right_bound >= (int) (props->text_offset + props->text_len))
+        if (right_bound >= (int) (props->start + props->len))
           {
              items = props->text_offset + props->text_len - base_cluster;
           }
index 77f3249..2e99cc7 100644 (file)
@@ -604,6 +604,27 @@ START_TEST(evas_textblock_cursor)
         fail_if(1 != evas_textblock_cursor_pos_get(cur));
      }
 
+   /* Make sure coords are correct for ligatures */
+     {
+        evas_object_textblock_text_markup_set(tb, "fi<br/>fii");
+
+        for (i = 0 ; i < 2 ; i++)
+          {
+             evas_textblock_cursor_pen_geometry_get(cur, NULL, NULL, &w, NULL);
+             ck_assert_int_eq(w, 3);
+             evas_textblock_cursor_char_next(cur);
+          }
+
+        evas_textblock_cursor_char_next(cur);
+
+        for (i = 0 ; i < 3 ; i++)
+          {
+             evas_textblock_cursor_pen_geometry_get(cur, NULL, NULL, &w, NULL);
+             ck_assert_int_eq(w, 3);
+             evas_textblock_cursor_char_next(cur);
+          }
+     }
+
    END_TB_TEST();
 }
 END_TEST