tasn pushed a commit to branch master.

http://git.enlightenment.org/core/efl.git/commit/?id=27b1bebea5a785d0b763e22bbd35f6dbc36a7fab

commit 27b1bebea5a785d0b763e22bbd35f6dbc36a7fab
Author: Tom Hacohen <t...@stosb.com>
Date:   Wed Feb 19 12:01:08 2014 +0000

    Evas text utils: Fixed walking compound clusters.
    
    In some scripts, like Devanagari, clusters can be split across more
    than just one glyph. This is now fixed.
    
    Thanks to YoungBok Shin for reporting.
---
 src/lib/evas/common/evas_text_utils.c | 24 ++++++++++++++++++++----
 1 file changed, 20 insertions(+), 4 deletions(-)

diff --git a/src/lib/evas/common/evas_text_utils.c 
b/src/lib/evas/common/evas_text_utils.c
index bb38f48..2b43695 100644
--- a/src/lib/evas/common/evas_text_utils.c
+++ b/src/lib/evas/common/evas_text_utils.c
@@ -117,8 +117,16 @@ _evas_common_text_props_cluster_move(const Evas_Text_Props 
*props, int pos,
    if (!right && (prop_pos > 0))
      {
 #ifdef OT_SUPPORT
-        return props->info->ot[props->start + prop_pos - 1].source_cluster -
-           props->text_offset;
+        int base_cluster = props->info->ot[props->start + 
prop_pos].source_cluster;
+        prop_pos--;
+        for ( ; prop_pos >= 0 ; prop_pos--)
+          {
+             int cur_cluster = props->info->ot[props->start + 
prop_pos].source_cluster;
+             if (cur_cluster != base_cluster)
+               {
+                  return cur_cluster - props->text_offset;
+               }
+          }
 #else
         return props->start + prop_pos - 1 - props->text_offset;
 #endif
@@ -126,8 +134,16 @@ _evas_common_text_props_cluster_move(const Evas_Text_Props 
*props, int pos,
    else if (right && (prop_pos < (int) (props->len - 1)))
      {
 #ifdef OT_SUPPORT
-        return props->info->ot[props->start + prop_pos + 1].source_cluster -
-           props->text_offset;
+        int base_cluster = props->info->ot[props->start + 
prop_pos].source_cluster;
+        prop_pos++;
+        for ( ; prop_pos < (int) props->len ; prop_pos++)
+          {
+             int cur_cluster = props->info->ot[props->start + 
prop_pos].source_cluster;
+             if (cur_cluster != base_cluster)
+               {
+                  return cur_cluster - props->text_offset;
+               }
+          }
 #else
         return props->start + prop_pos + 1 - props->text_offset;
 #endif

-- 


Reply via email to