diff --git a/src/lib/evas/common/evas_font_query.c b/src/lib/evas/common/evas_font_query.c index 1c219ee3b3..f435b9b0c3 100644 --- a/src/lib/evas/common/evas_font_query.c +++ b/src/lib/evas/common/evas_font_query.c @@ -823,7 +823,7 @@ evas_common_font_query_last_up_to_pos(RGBA_Font *fn, const Evas_Text_Props *text if ((x >= pen_x) && (((i == 0) && (x <= full_adv)) || (x < (full_adv - (gli[-1].pen_after - start_pen)) || - (x <= (pen_x + gli->width)))) && + (x < (pen_x + gli->x_bear + gli->width)))) && (y >= -asc) && (y <= desc)) { #ifdef OT_SUPPORT @@ -850,8 +850,9 @@ evas_common_font_query_last_up_to_pos(RGBA_Font *fn, const Evas_Text_Props *text if ((x >= EVAS_FONT_WALK_PEN_X) && ((x < (EVAS_FONT_WALK_PEN_X_AFTER)) || - (x <= (EVAS_FONT_WALK_PEN_X + _glyph_itr->width))) && - (y >= -asc) && (y <= desc)) + (x < (EVAS_FONT_WALK_PEN_X + + _glyph_itr->x_bear + _glyph_itr->width))) && + (y >= -asc) && (y <= desc)) { ret = EVAS_FONT_WALK_POS; goto end; diff --git a/src/tests/evas/evas_test_textblock.c b/src/tests/evas/evas_test_textblock.c index cfa0aeebd6..63da9028e8 100644 --- a/src/tests/evas/evas_test_textblock.c +++ b/src/tests/evas/evas_test_textblock.c @@ -2210,6 +2210,20 @@ START_TEST(evas_textblock_wrapping) evas_object_textblock_size_formatted_get(tb, NULL, &h); ck_assert_int_ge(h, bh); + /* Check char-wrapping for small items */ + evas_object_textblock_text_markup_set(tb, "x"); + evas_object_textblock_size_native_get(tb, &bw, NULL); + evas_object_textblock_text_markup_set(tb, "AxAx"); + evas_textblock_cursor_format_prepend(cur, "+ wrap=char"); + evas_object_textblock_size_native_get(tb, &nw, &nh); + evas_object_resize(tb, nw - bw, nh); + evas_object_textblock_size_formatted_get(tb, &bw, NULL); + + evas_object_textblock_text_markup_set(tb, "AxAx"); + evas_textblock_cursor_format_prepend(cur, "+ wrap=char"); + evas_object_textblock_size_formatted_get(tb, &w, NULL); + ck_assert_int_eq(bw, w); + END_TB_TEST(); } END_TEST