aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTom Hacohen <tom@stosb.com>2014-02-19 12:01:08 +0000
committerTom Hacohen <tom@stosb.com>2014-02-19 12:10:36 +0000
commit69e47a5407600b034731cb0bfa46895acfea65b6 (patch)
tree9832c9bce0602ab84f4a57f530955bd3767f4ed3
parentEvas textblock tests: Add a wrapping test for complex cluster wrapping. (diff)
downloadefl-69e47a5407600b034731cb0bfa46895acfea65b6.tar.gz
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.
-rw-r--r--src/lib/evas/common/evas_text_utils.c24
1 files 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 fe17101508..d7aa3ad94c 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