summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Hirt <hirt.danny@gmail.com>2016-07-31 00:48:12 +0300
committerDaniel Hirt <daniel.hirt@samsung.com>2016-07-31 10:33:30 +0300
commit0d9ddc45145cbbac5358d3c3cd343e18ddf11a46 (patch)
tree9637ed3b8e237808fe3c5a2e7bead690f431b373
parent4352747956f3f0d5df9ec8d1dd9ed86d29ba0045 (diff)
Canvas text: fix range geometry calculation for RTL
Fixes T3627. @fix
-rw-r--r--src/lib/evas/canvas/evas_object_textblock.c27
-rw-r--r--src/tests/evas/evas_test_textblock.c9
2 files changed, 20 insertions, 16 deletions
diff --git a/src/lib/evas/canvas/evas_object_textblock.c b/src/lib/evas/canvas/evas_object_textblock.c
index da4840e2ca..f06d8760d1 100644
--- a/src/lib/evas/canvas/evas_object_textblock.c
+++ b/src/lib/evas/canvas/evas_object_textblock.c
@@ -11772,6 +11772,14 @@ _evas_textblock_cursor_range_in_line_geometry_get(
11772 return NULL; 11772 return NULL;
11773 } 11773 }
11774 11774
11775#ifdef BIDI_SUPPORT
11776 if (ti->text_props.bidi_dir == EVAS_BIDI_DIRECTION_RTL)
11777 {
11778 x1 = x1 + w1;
11779 x2 = x2 + w2;
11780 }
11781#endif
11782
11775 /* Make x2 the one on the right */ 11783 /* Make x2 the one on the right */
11776 if (x2 < x1) 11784 if (x2 < x1)
11777 { 11785 {
@@ -11779,24 +11787,11 @@ _evas_textblock_cursor_range_in_line_geometry_get(
11779 tmp = x1; 11787 tmp = x1;
11780 x1 = x2; 11788 x1 = x2;
11781 x2 = tmp; 11789 x2 = tmp;
11782
11783 tmp = w1;
11784 w1 = w2;
11785 w2 = tmp;
11786 } 11790 }
11787 11791
11788#ifdef BIDI_SUPPORT 11792 x = x1;
11789 if (ti->text_props.bidi_dir == EVAS_BIDI_DIRECTION_RTL) 11793 w = x2 - x1;
11790 { 11794
11791 x = x1 + w1;
11792 w = x2 + w2 - x;
11793 }
11794 else
11795#endif
11796 {
11797 x = x1;
11798 w = x2 - x1;
11799 }
11800 if (w > 0) 11795 if (w > 0)
11801 { 11796 {
11802 tr = calloc(1, sizeof(Evas_Textblock_Rectangle)); 11797 tr = calloc(1, sizeof(Evas_Textblock_Rectangle));
diff --git a/src/tests/evas/evas_test_textblock.c b/src/tests/evas/evas_test_textblock.c
index 70ba06bbfe..efee1efd77 100644
--- a/src/tests/evas/evas_test_textblock.c
+++ b/src/tests/evas/evas_test_textblock.c
@@ -2452,6 +2452,15 @@ START_TEST(evas_textblock_geometries)
2452 free(tr2); 2452 free(tr2);
2453 2453
2454 /* Same run different scripts */ 2454 /* Same run different scripts */
2455 evas_object_textblock_text_markup_set(tb, "עברית");
2456 evas_textblock_cursor_pos_set(main_cur, 4); // last character
2457 evas_textblock_cursor_pos_set(cur, 5); // after last character
2458
2459 rects = evas_textblock_cursor_range_geometry_get(cur, main_cur);
2460 fail_if(!rects);
2461 EINA_LIST_FREE(rects, tr)
2462 free(tr);
2463
2455 evas_object_textblock_text_markup_set(tb, "עבריתenglishрусскийעברית"); 2464 evas_object_textblock_text_markup_set(tb, "עבריתenglishрусскийעברית");
2456 2465
2457 evas_textblock_cursor_pos_set(cur, 3); 2466 evas_textblock_cursor_pos_set(cur, 3);