if (found)
{
int item_pos;
+ Evas_Coord cx_it, cw_it, cmid;
Evas_Coord cluster_adv;
cluster_adv = EVAS_FONT_WALK_PEN_X - cluster_start;
part = cluster_adv / items;
item_pos = items - ((int) ((x - cluster_start) / part)) - 1;
}
- if (cx) *cx = EVAS_FONT_WALK_PEN_X +
- ((cluster_adv / items) * (item_pos - 1));
+
+ cx_it = EVAS_FONT_WALK_PEN_X + ((cluster_adv / items) * (item_pos - 1));
+ cw_it = (cluster_adv / items);
+
+ if (cx) *cx = cx_it;
if (cy) *cy = -asc;
- if (cw) *cw = (cluster_adv / items);
+ if (cw) *cw = cw_it;
if (ch) *ch = asc + desc;
ret_val = prev_cluster + item_pos;
+
+ /* Check, if x coord points to RIGHT half part of LTR char
+ * or to LEFT half char of RTL char. If so, increment found position */
+ cmid = cx_it + (cw_it / 2);
+ if (text_props->bidi.dir == EVAS_BIDI_DIRECTION_LTR)
+ {
+ if (x > cmid)
+ {
+ ret_val++;
+ }
+ }
+ else
+ {
+ if (x < cmid)
+ {
+ ret_val++;
+ }
+ }
+
goto end;
}
end:
fail_if(x <= px);
px = x;
/* Get back the coords */
- fail_if(i != evas_object_text_char_coords_get(to, x + (w / 2),
+ fail_if(i != evas_object_text_char_coords_get(to, x + (w / 4),
+ y + (h / 2), NULL, NULL, NULL, NULL));
+ /* Get back cursor position, if click on right half of char. */
+ fail_if((i + 1) != evas_object_text_char_coords_get(to, x + ((3 * w) / 4),
y + (h / 2), &x, &y, &w, &h));
}
fail_if(x >= px);
px = x;
/* Get back the coords */
- fail_if(i != evas_object_text_char_coords_get(to, x + (w / 2),
+ fail_if(i != evas_object_text_char_coords_get(to, x + ((3 * w) / 4),
+ y + (h / 2), &x, &y, &w, &h));
+ }
+
+ /* Get back cursor position, if click on left half of char. */
+ evas_object_text_text_set(to, "שלום...");
+ x = 0;
+ px = 200;
+ for (i = 0 ; i < eina_unicode_utf8_get_len("שלום...") ; i++)
+ {
+ fail_if(!evas_object_text_char_pos_get(to, i, &x, &y, &w, &h));
+ fail_if(x >= px);
+ px = x;
+ fail_if((i + 1) != evas_object_text_char_coords_get(to, x + (w / 4),
y + (h / 2), &x, &y, &w, &h));
}
fail_if(x <= px);
px = x;
/* Get back the coords */
- fail_if(i != evas_object_text_char_coords_get(to, x + (w / 2),
+ fail_if(i != evas_object_text_char_coords_get(to, x + (w / 4),
y + (h / 2), &x, &y, &w, &h));
}
fail_if(!evas_object_text_char_pos_get(to, i, &x, &y, &w, &h));
fail_if(x <= px);
px = x;
- fail_if(i != evas_object_text_char_coords_get(to, x + (w / 2),
+ fail_if(i != evas_object_text_char_coords_get(to, x + ((3 * w) / 4),
y + (h / 2), &x, &y, &w, &h));
i++;
for ( ; i < eina_unicode_utf8_get_len("Test - נסיון") ; i++)
fail_if(x >= px);
px = x;
/* Get back the coords */
- fail_if(i != evas_object_text_char_coords_get(to, x + (w / 2),
+ if (w == 0)
+ {
+ int cx;
+ fail_if(!evas_object_text_char_pos_get(to, i - 1, &cx, NULL, NULL, NULL));
+ w = cx - x;
+ }
+ fail_if(i != evas_object_text_char_coords_get(to, x + ((3 * w) / 4),
y + (h / 2), &x, &y, &w, &h));
}