Canvas text: fix range geometry calculation for RTL

Fixes T3627.

@fix
This commit is contained in:
Daniel Hirt 2016-07-31 00:48:12 +03:00 committed by Daniel Hirt
parent 4352747956
commit 0d9ddc4514
2 changed files with 20 additions and 16 deletions

View File

@ -11772,6 +11772,14 @@ _evas_textblock_cursor_range_in_line_geometry_get(
return NULL;
}
#ifdef BIDI_SUPPORT
if (ti->text_props.bidi_dir == EVAS_BIDI_DIRECTION_RTL)
{
x1 = x1 + w1;
x2 = x2 + w2;
}
#endif
/* Make x2 the one on the right */
if (x2 < x1)
{
@ -11779,24 +11787,11 @@ _evas_textblock_cursor_range_in_line_geometry_get(
tmp = x1;
x1 = x2;
x2 = tmp;
tmp = w1;
w1 = w2;
w2 = tmp;
}
#ifdef BIDI_SUPPORT
if (ti->text_props.bidi_dir == EVAS_BIDI_DIRECTION_RTL)
{
x = x1 + w1;
w = x2 + w2 - x;
}
else
#endif
{
x = x1;
w = x2 - x1;
}
x = x1;
w = x2 - x1;
if (w > 0)
{
tr = calloc(1, sizeof(Evas_Textblock_Rectangle));

View File

@ -2452,6 +2452,15 @@ START_TEST(evas_textblock_geometries)
free(tr2);
/* Same run different scripts */
evas_object_textblock_text_markup_set(tb, "עברית");
evas_textblock_cursor_pos_set(main_cur, 4); // last character
evas_textblock_cursor_pos_set(cur, 5); // after last character
rects = evas_textblock_cursor_range_geometry_get(cur, main_cur);
fail_if(!rects);
EINA_LIST_FREE(rects, tr)
free(tr);
evas_object_textblock_text_markup_set(tb, "עבריתenglishрусскийעברית");
evas_textblock_cursor_pos_set(cur, 3);