summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorYoungbok Shin <youngb.shin@samsung.com>2017-09-25 18:35:23 +0900
committerCarsten Haitzler (Rasterman) <raster@rasterman.com>2017-09-26 11:31:31 +0900
commit4d4401f3a60024a0762393c3984065b73927eb86 (patch)
tree1bfab6e3edb1e01db0e75c001d2d345528a9e958
parent17504106501cec1a0a85eb380c5dea7e0ca3729c (diff)
evas textblock: use primary font's size as minimum size of a line
Summary: Textblock uses ascent, descent from primary font when there is no text. If a text is set which need other font, Textblock uses ascent, descent from actually loaded font. If loaded font has smaller size, text cursor and text looks jerky in elm_entry. At least, primary font's size should be respected as minimum size of a line for avoiding this issue. In addition, the patch will allow negative line gap values. @fix Test Plan: Put your hamburger(🍔) in Ecrire. And put an english character. (Put a text which will load smaller font. And put a text which will load primary font.) Reviewers: raster, cedric, herdsman, jpeg, woohyun Reviewed By: raster Differential Revision: https://phab.enlightenment.org/D5217
-rw-r--r--src/lib/evas/canvas/evas_object_textblock.c54
1 files changed, 23 insertions, 31 deletions
diff --git a/src/lib/evas/canvas/evas_object_textblock.c b/src/lib/evas/canvas/evas_object_textblock.c
index c804522f21..d371ab00a9 100644
--- a/src/lib/evas/canvas/evas_object_textblock.c
+++ b/src/lib/evas/canvas/evas_object_textblock.c
@@ -2937,8 +2937,8 @@ _layout_format_ascent_descent_adjust(Evas_Object_Protected_Data *obj,
2937 } 2937 }
2938 descent += fmt->linegap * obj->cur->scale; 2938 descent += fmt->linegap * obj->cur->scale;
2939 descent += ((ascent + descent) * fmt->linerelgap); 2939 descent += ((ascent + descent) * fmt->linerelgap);
2940 if (*maxascent < ascent) *maxascent = ascent; 2940 *maxascent = ascent;
2941 if (*maxdescent < descent) *maxdescent = descent; 2941 *maxdescent = descent;
2942 if (fmt->linefill > 0.0) 2942 if (fmt->linefill > 0.0)
2943 { 2943 {
2944 int dh; 2944 int dh;
@@ -2974,18 +2974,13 @@ _layout_item_max_ascent_descent_calc(Evas_Object_Protected_Data *obj,
2974 { 2974 {
2975 Evas_Coord asc = 0; 2975 Evas_Coord asc = 0;
2976 2976
2977 *maxascent = ENFN->font_max_ascent_get(ENC, it->format->font.font);
2978
2977 if (fi) 2979 if (fi)
2978 { 2980 asc = evas_common_font_instance_max_ascent_get(fi);
2979 asc = evas_common_font_instance_max_ascent_get(fi);
2980 }
2981 else
2982 {
2983 asc = ENFN->font_max_ascent_get(ENC,
2984 it->format->font.font);
2985 }
2986 2981
2987 if (asc > *maxascent) 2982 if (asc > *maxascent)
2988 *maxascent = asc; 2983 *maxascent = asc;
2989 } 2984 }
2990 2985
2991 if ((position == TEXTBLOCK_POSITION_END) || 2986 if ((position == TEXTBLOCK_POSITION_END) ||
@@ -2994,18 +2989,13 @@ _layout_item_max_ascent_descent_calc(Evas_Object_Protected_Data *obj,
2994 /* Calculate max descent. */ 2989 /* Calculate max descent. */
2995 Evas_Coord desc = 0; 2990 Evas_Coord desc = 0;
2996 2991
2992 *maxdescent = ENFN->font_max_descent_get(ENC, it->format->font.font);
2993
2997 if (fi) 2994 if (fi)
2998 { 2995 desc = evas_common_font_instance_max_descent_get(fi);
2999 desc = evas_common_font_instance_max_descent_get(fi);
3000 }
3001 else
3002 {
3003 desc = ENFN->font_max_descent_get(ENC,
3004 it->format->font.font);
3005 }
3006 2996
3007 if (desc > *maxdescent) 2997 if (desc > *maxdescent)
3008 *maxdescent = desc; 2998 *maxdescent = desc;
3009 } 2999 }
3010} 3000}
3011 3001
@@ -3042,23 +3032,25 @@ _layout_item_ascent_descent_adjust(Evas_Object_Protected_Data *obj,
3042 } 3032 }
3043 } 3033 }
3044 3034
3035 if (fmt)
3036 {
3037 asc = ENFN->font_ascent_get(ENC, fmt->font.font);
3038 desc = ENFN->font_descent_get(ENC, fmt->font.font);
3039
3040 if (asc > *ascent) *ascent = asc;
3041 if (desc > *descent) *descent = desc;
3042 }
3043
3045 if (fi) 3044 if (fi)
3046 { 3045 {
3047 asc = evas_common_font_instance_ascent_get(fi); 3046 asc = evas_common_font_instance_ascent_get(fi);
3048 desc = evas_common_font_instance_descent_get(fi); 3047 desc = evas_common_font_instance_descent_get(fi);
3048
3049 if (asc > *ascent) *ascent = asc;
3050 if (desc > *descent) *descent = desc;
3049 } 3051 }
3050 else
3051 {
3052 if (fmt)
3053 {
3054 asc = ENFN->font_ascent_get(ENC, fmt->font.font);
3055 desc = ENFN->font_descent_get(ENC, fmt->font.font);
3056 }
3057 }
3058 if (fmt) _layout_format_ascent_descent_adjust(obj, &asc, &desc, fmt);
3059 3052
3060 if (asc > *ascent) *ascent = asc; 3053 if (fmt) _layout_format_ascent_descent_adjust(obj, ascent, descent, fmt);
3061 if (desc > *descent) *descent = desc;
3062} 3054}
3063 3055
3064/** 3056/**