summaryrefslogtreecommitdiff
path: root/src/lib/evas/common/evas_font_main.c
diff options
context:
space:
mode:
authorCarsten Haitzler (Rasterman) <raster@rasterman.com>2013-05-31 19:07:50 +0900
committerCarsten Haitzler (Rasterman) <raster@rasterman.com>2013-05-31 19:08:35 +0900
commit9473c4a9a5b9e056e516b660895cb83c64a1c77f (patch)
tree8972a39fc5094da2eb0142782679c38c7d9c7b63 /src/lib/evas/common/evas_font_main.c
parentb524b31256c4ab10a9e8f0621323447377b4916f (diff)
continuation of ascent/descent fix by tom - make textblock work too.
Diffstat (limited to '')
-rw-r--r--src/lib/evas/common/evas_font_main.c48
1 files changed, 44 insertions, 4 deletions
diff --git a/src/lib/evas/common/evas_font_main.c b/src/lib/evas/common/evas_font_main.c
index 43d467c0b9..1048ad10d1 100644
--- a/src/lib/evas/common/evas_font_main.c
+++ b/src/lib/evas/common/evas_font_main.c
@@ -84,6 +84,7 @@ evas_common_font_instance_ascent_get(RGBA_Font_Int *fi)
84 FTUNLOCK(); 84 FTUNLOCK();
85 fi->src->current_size = fi->size; 85 fi->src->current_size = fi->size;
86 } 86 }
87 if (!fi->src->ft.face) return 0;
87 if (!FT_IS_SCALABLE(fi->src->ft.face)) 88 if (!FT_IS_SCALABLE(fi->src->ft.face))
88 { 89 {
89 WRN("NOT SCALABLE!"); 90 WRN("NOT SCALABLE!");
@@ -110,6 +111,7 @@ evas_common_font_instance_descent_get(RGBA_Font_Int *fi)
110 FTUNLOCK(); 111 FTUNLOCK();
111 fi->src->current_size = fi->size; 112 fi->src->current_size = fi->size;
112 } 113 }
114 if (!fi->src->ft.face) return 0;
113 val = -(int)fi->src->ft.face->size->metrics.descender; 115 val = -(int)fi->src->ft.face->size->metrics.descender;
114 return FONT_METRIC_ROUNDUP(val); 116 return FONT_METRIC_ROUNDUP(val);
115// if (fi->src->ft.face->units_per_EM == 0) 117// if (fi->src->ft.face->units_per_EM == 0)
@@ -133,6 +135,7 @@ evas_common_font_instance_max_ascent_get(RGBA_Font_Int *fi)
133 FTUNLOCK(); 135 FTUNLOCK();
134 fi->src->current_size = fi->size; 136 fi->src->current_size = fi->size;
135 } 137 }
138 if (!fi->src->ft.face) return 0;
136 if ((fi->src->ft.face->bbox.yMax == 0) && 139 if ((fi->src->ft.face->bbox.yMax == 0) &&
137 (fi->src->ft.face->bbox.yMin == 0) && 140 (fi->src->ft.face->bbox.yMin == 0) &&
138 (fi->src->ft.face->units_per_EM == 0)) 141 (fi->src->ft.face->units_per_EM == 0))
@@ -160,6 +163,7 @@ evas_common_font_instance_max_descent_get(RGBA_Font_Int *fi)
160 FTUNLOCK(); 163 FTUNLOCK();
161 fi->src->current_size = fi->size; 164 fi->src->current_size = fi->size;
162 } 165 }
166 if (!fi->src->ft.face) return 0;
163 if ((fi->src->ft.face->bbox.yMax == 0) && 167 if ((fi->src->ft.face->bbox.yMax == 0) &&
164 (fi->src->ft.face->bbox.yMin == 0) && 168 (fi->src->ft.face->bbox.yMin == 0) &&
165 (fi->src->ft.face->units_per_EM == 0)) 169 (fi->src->ft.face->units_per_EM == 0))
@@ -177,28 +181,64 @@ EAPI int
177evas_common_font_ascent_get(RGBA_Font *fn) 181evas_common_font_ascent_get(RGBA_Font *fn)
178{ 182{
179// evas_common_font_size_use(fn); 183// evas_common_font_size_use(fn);
180 return evas_common_font_instance_ascent_get(fn->fonts->data); 184 int max = 0, v;
185 Eina_List *l;
186 RGBA_Font_Int *fi;
187
188 EINA_LIST_FOREACH(fn->fonts, l, fi)
189 {
190 v = evas_common_font_instance_ascent_get(fi);
191 if (v > max) max = v;
192 }
193 return max;
181} 194}
182 195
183EAPI int 196EAPI int
184evas_common_font_descent_get(RGBA_Font *fn) 197evas_common_font_descent_get(RGBA_Font *fn)
185{ 198{
186// evas_common_font_size_use(fn); 199// evas_common_font_size_use(fn);
187 return evas_common_font_instance_descent_get(fn->fonts->data); 200 int max = 0, v;
201 Eina_List *l;
202 RGBA_Font_Int *fi;
203
204 EINA_LIST_FOREACH(fn->fonts, l, fi)
205 {
206 v = evas_common_font_instance_descent_get(fi);
207 if (v > max) max = v;
208 }
209 return max;
188} 210}
189 211
190EAPI int 212EAPI int
191evas_common_font_max_ascent_get(RGBA_Font *fn) 213evas_common_font_max_ascent_get(RGBA_Font *fn)
192{ 214{
193// evas_common_font_size_use(fn); 215// evas_common_font_size_use(fn);
194 return evas_common_font_instance_max_ascent_get(fn->fonts->data); 216 int max = 0, v;
217 Eina_List *l;
218 RGBA_Font_Int *fi;
219
220 EINA_LIST_FOREACH(fn->fonts, l, fi)
221 {
222 v = evas_common_font_instance_max_ascent_get(fi);
223 if (v > max) max = v;
224 }
225 return max;
195} 226}
196 227
197EAPI int 228EAPI int
198evas_common_font_max_descent_get(RGBA_Font *fn) 229evas_common_font_max_descent_get(RGBA_Font *fn)
199{ 230{
200// evas_common_font_size_use(fn); 231// evas_common_font_size_use(fn);
201 return evas_common_font_instance_max_descent_get(fn->fonts->data); 232 int max = 0, v;
233 Eina_List *l;
234 RGBA_Font_Int *fi;
235
236 EINA_LIST_FOREACH(fn->fonts, l, fi)
237 {
238 v = evas_common_font_instance_max_descent_get(fi);
239 if (v > max) max = v;
240 }
241 return max;
202} 242}
203 243
204EAPI int 244EAPI int