summaryrefslogtreecommitdiff
path: root/src/lib/evas/common
diff options
context:
space:
mode:
authorYoungbok Shin <youngb.shin@samsung.com>2017-04-10 12:15:19 +0900
committerCarsten Haitzler (Rasterman) <raster@rasterman.com>2017-04-10 12:15:20 +0900
commit1ab87367d8f1c0f416a65c4a43d96bb2f3683052 (patch)
tree84bb247e3f23febd106dde07a63388f0d17c18c7 /src/lib/evas/common
parent46bfd7ffb9e96c78989af455c6699ed22cc3d683 (diff)
evas: give width offset when Evas tries to find ellipsis position
Summary: If the last item before ellipsis item has bigger width than its advance, evas_common_font_query_last_up_to_pos() function can find wrong ellipsis position. When Evas finds a position for non last item, Evas must care about additionally available space for glyph's width of the given x position. ex) the last item's glyph before ellipsis item has a tail to draw above the ellipsis item. @fix Test Plan: Test case will added as comment. (Becasue of font license problem.) Reviewers: herdsman, raster, jpeg, woohyun Subscribers: cedric, Blackmole Differential Revision: https://phab.enlightenment.org/D4727
Diffstat (limited to 'src/lib/evas/common')
-rw-r--r--src/lib/evas/common/evas_font.h2
-rw-r--r--src/lib/evas/common/evas_font_query.c12
2 files changed, 11 insertions, 3 deletions
diff --git a/src/lib/evas/common/evas_font.h b/src/lib/evas/common/evas_font.h
index 3d59201776..f9f8026c85 100644
--- a/src/lib/evas/common/evas_font.h
+++ b/src/lib/evas/common/evas_font.h
@@ -80,7 +80,7 @@ EAPI void evas_common_font_query_advance (RGBA_Font *fn, con
80EAPI int evas_common_font_query_char_coords (RGBA_Font *fn, const Evas_Text_Props *intl_props, int pos, int *cx, int *cy, int *cw, int *ch); 80EAPI int evas_common_font_query_char_coords (RGBA_Font *fn, const Evas_Text_Props *intl_props, int pos, int *cx, int *cy, int *cw, int *ch);
81EAPI int evas_common_font_query_pen_coords (RGBA_Font *fn, const Evas_Text_Props *intl_props, int pos, int *cpen_x, int *cy, int *cadv, int *ch); 81EAPI int evas_common_font_query_pen_coords (RGBA_Font *fn, const Evas_Text_Props *intl_props, int pos, int *cpen_x, int *cy, int *cadv, int *ch);
82EAPI int evas_common_font_query_char_at_coords (RGBA_Font *fn, const Evas_Text_Props *intl_props, int x, int y, int *cx, int *cy, int *cw, int *ch); 82EAPI int evas_common_font_query_char_at_coords (RGBA_Font *fn, const Evas_Text_Props *intl_props, int x, int y, int *cx, int *cy, int *cw, int *ch);
83EAPI int evas_common_font_query_last_up_to_pos (RGBA_Font *fn, const Evas_Text_Props *intl_props, int x, int y); 83EAPI int evas_common_font_query_last_up_to_pos (RGBA_Font *fn, const Evas_Text_Props *intl_props, int x, int y, int width_offset);
84EAPI int evas_common_font_query_run_font_end_get(RGBA_Font *fn, RGBA_Font_Int **script_fi, RGBA_Font_Int **cur_fi, Evas_Script_Type script, const Eina_Unicode *text, int run_len); 84EAPI int evas_common_font_query_run_font_end_get(RGBA_Font *fn, RGBA_Font_Int **script_fi, RGBA_Font_Int **cur_fi, Evas_Script_Type script, const Eina_Unicode *text, int run_len);
85EAPI void evas_common_font_ascent_descent_get(RGBA_Font *fn, const Evas_Text_Props *text_props, int *ascent, int *descent); 85EAPI void evas_common_font_ascent_descent_get(RGBA_Font *fn, const Evas_Text_Props *text_props, int *ascent, int *descent);
86 86
diff --git a/src/lib/evas/common/evas_font_query.c b/src/lib/evas/common/evas_font_query.c
index 2deb8386e4..c52486b3cb 100644
--- a/src/lib/evas/common/evas_font_query.c
+++ b/src/lib/evas/common/evas_font_query.c
@@ -813,7 +813,7 @@ end:
813 * @return the position found, -1 on failure. 813 * @return the position found, -1 on failure.
814 */ 814 */
815EAPI int 815EAPI int
816evas_common_font_query_last_up_to_pos(RGBA_Font *fn, const Evas_Text_Props *text_props, int x, int y) 816evas_common_font_query_last_up_to_pos(RGBA_Font *fn, const Evas_Text_Props *text_props, int x, int y, int width_offset)
817{ 817{
818 int asc, desc; 818 int asc, desc;
819 int ret=-1; 819 int ret=-1;
@@ -845,6 +845,14 @@ evas_common_font_query_last_up_to_pos(RGBA_Font *fn, const Evas_Text_Props *text
845 pen_x = full_adv - (gli->pen_after - start_pen); 845 pen_x = full_adv - (gli->pen_after - start_pen);
846 /* If invisible, skip */ 846 /* If invisible, skip */
847 if (gli->index == 0) continue; 847 if (gli->index == 0) continue;
848
849 /* FIXME: Should we care glyph's width for RTL?
850 I think if width+x_bear/advance stacked from left side,
851 we don't need to care glyph's width to find linebreak position
852 or ellipsis position.
853 Even if (x < (pen_x + gli->x_bear + gli->width)))) is removed,
854 the whole test suite is passed.
855 */
848 if ((x >= pen_x) && 856 if ((x >= pen_x) &&
849 (((i == 0) && (x <= full_adv)) || 857 (((i == 0) && (x <= full_adv)) ||
850 (x < (full_adv - (gli[-1].pen_after - start_pen)) || 858 (x < (full_adv - (gli[-1].pen_after - start_pen)) ||
@@ -875,7 +883,7 @@ evas_common_font_query_last_up_to_pos(RGBA_Font *fn, const Evas_Text_Props *text
875 883
876 if ((x >= EVAS_FONT_WALK_PEN_X) && 884 if ((x >= EVAS_FONT_WALK_PEN_X) &&
877 ((x < (EVAS_FONT_WALK_PEN_X_AFTER)) || 885 ((x < (EVAS_FONT_WALK_PEN_X_AFTER)) ||
878 (x < (EVAS_FONT_WALK_PEN_X + 886 (x + width_offset < (EVAS_FONT_WALK_PEN_X +
879 _glyph_itr->x_bear + _glyph_itr->width))) && 887 _glyph_itr->x_bear + _glyph_itr->width))) &&
880 (y >= -asc) && (y <= desc)) 888 (y >= -asc) && (y <= desc))
881 { 889 {