tasn pushed a commit to branch master.

commit 920c1b2af826dc53e67d1bd3b5eab00c232e6550
Author: Tom Hacohen <[email protected]>
Date:   Mon Apr 8 13:30:31 2013 +0100

    Evas font: Fixed a bug with cluster sizes and ligatures.
    
    This casused cursor position (among other things) to look wrong with texts
    ending with ligatures.
    
    Thanks to Yakov Goldberg for reporting.
---
 ChangeLog                            |  5 +++++
 NEWS                                 |  2 ++
 src/lib/evas/common/evas_font_ot.c   |  2 +-
 src/tests/evas/evas_test_textblock.c | 21 +++++++++++++++++++++
 4 files changed, 29 insertions(+), 1 deletion(-)

diff --git a/ChangeLog b/ChangeLog
index 4c3e158..f9734d0 100644
--- 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
--- 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.
diff --git a/src/lib/evas/common/evas_font_ot.c 
b/src/lib/evas/common/evas_font_ot.c
index da563e0..0024376 100644
--- a/src/lib/evas/common/evas_font_ot.c
+++ b/src/lib/evas/common/evas_font_ot.c
@@ -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;
           }
diff --git a/src/tests/evas/evas_test_textblock.c 
b/src/tests/evas/evas_test_textblock.c
index 77f3249..2e99cc7 100644
--- a/src/tests/evas/evas_test_textblock.c
+++ b/src/tests/evas/evas_test_textblock.c
@@ -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

-- 

------------------------------------------------------------------------------
Minimize network downtime and maximize team effectiveness.
Reduce network management and security costs.Learn how to hire 
the most talented Cisco Certified professionals. Visit the 
Employer Resources Portal
http://www.cisco.com/web/learning/employer_resources/index.html

Reply via email to