aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/lib/evas/canvas/evas_object_text.c10
-rw-r--r--src/tests/evas/evas_test_text.c36
2 files changed, 33 insertions, 13 deletions
diff --git a/src/lib/evas/canvas/evas_object_text.c b/src/lib/evas/canvas/evas_object_text.c
index 98b3ac46d..45f82d31f 100644
--- a/src/lib/evas/canvas/evas_object_text.c
+++ b/src/lib/evas/canvas/evas_object_text.c
@@ -820,12 +820,11 @@ _evas_object_text_layout(Evas_Object *eo_obj, Evas_Object_Text *o, Eina_Unicode
}
if (itr && (itr != start_ellip_it))
{
- int cut = 1 + ENFN->font_char_at_coords_get(ENDT,
+ int cut = 1 + ENFN->font_last_up_to_pos(ENDT,
o->font,
&itr->text_props,
ellipsis_coord - advance,
- 0,
- NULL, NULL, NULL, NULL);
+ 0);
if (cut > 0)
{
start_ellip_it->text_pos = itr->text_pos;
@@ -864,12 +863,11 @@ _evas_object_text_layout(Evas_Object *eo_obj, Evas_Object_Text *o, Eina_Unicode
/* FIXME: We shouldn't do anything. */
}
- int cut = ENFN->font_char_at_coords_get(ENDT,
+ int cut = ENFN->font_last_up_to_pos(ENDT,
o->font,
&itr->text_props,
ellip_frame - advance,
- 0,
- NULL, NULL, NULL, NULL);
+ 0);
if (cut >= 0)
{
end_ellip_it->text_pos = itr->text_pos + cut;
diff --git a/src/tests/evas/evas_test_text.c b/src/tests/evas/evas_test_text.c
index 861849f9d..e0a9fad4f 100644
--- a/src/tests/evas/evas_test_text.c
+++ b/src/tests/evas/evas_test_text.c
@@ -166,14 +166,10 @@ START_TEST(evas_text_evas)
}
END_TEST
-START_TEST(evas_text_ellipsis)
+static void
+_test_ellipsis(Evas_Object *to, const char *buf, const char *font, Evas_Font_Size size, double ellipsis)
{
- START_TEXT_TEST();
- const char *buf = "נסיון בלה בלה בלה בלה";
- const char *font = TEST_FONT_NAME;
- Evas_Font_Size size = 14;
-
- evas_object_text_ellipsis_set(to, 0.0);
+ evas_object_text_ellipsis_set(to, ellipsis);
evas_object_move(to, 0, 0);
evas_object_resize(to, 500, 500);
evas_object_text_font_set(to, font, size);
@@ -191,7 +187,33 @@ START_TEST(evas_text_ellipsis)
/* If it's gotten way too small, it means we have an issue. */
fail_if(w < 100);
}
+}
+
+START_TEST(evas_text_ellipsis)
+{
+ START_TEXT_TEST();
+ const char *buf = "נסיון בלה בלה בלה בלה";
+ const char *font = TEST_FONT_NAME;
+ Evas_Font_Size size = 14;
+
+ /* Test various ellipsis types. */
+
+ /* RTL */
+ _test_ellipsis(to, buf, font, size, 0.0);
+ _test_ellipsis(to, buf, font, size, 0.5);
+ _test_ellipsis(to, buf, font, size, 1.0);
+
+ /* BiDi */
+ buf = "Test נסיון בלה בלה בלה";
+ _test_ellipsis(to, buf, font, size, 0.0);
+ _test_ellipsis(to, buf, font, size, 0.5);
+ _test_ellipsis(to, buf, font, size, 1.0);
+ /* LTR */
+ buf = "Test test test test test";
+ _test_ellipsis(to, buf, font, size, 0.0);
+ _test_ellipsis(to, buf, font, size, 0.5);
+ _test_ellipsis(to, buf, font, size, 1.0);
END_TEXT_TEST();
}