summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/lib/evas/common/evas_font.h2
-rw-r--r--src/lib/evas/common/evas_font_main.c56
2 files changed, 58 insertions, 0 deletions
diff --git a/src/lib/evas/common/evas_font.h b/src/lib/evas/common/evas_font.h
index 403b501941..cf6739e33c 100644
--- a/src/lib/evas/common/evas_font.h
+++ b/src/lib/evas/common/evas_font.h
@@ -18,6 +18,8 @@ EAPI int evas_common_font_instance_ascent_get (RGBA_Font
18EAPI int evas_common_font_instance_descent_get (RGBA_Font_Int *fi); 18EAPI int evas_common_font_instance_descent_get (RGBA_Font_Int *fi);
19EAPI int evas_common_font_instance_max_ascent_get (RGBA_Font_Int *fi); 19EAPI int evas_common_font_instance_max_ascent_get (RGBA_Font_Int *fi);
20EAPI int evas_common_font_instance_max_descent_get (RGBA_Font_Int *fi); 20EAPI int evas_common_font_instance_max_descent_get (RGBA_Font_Int *fi);
21EAPI int evas_common_font_instance_underline_position_get (RGBA_Font_Int *fi);
22EAPI int evas_common_font_instance_underline_thickness_get (RGBA_Font_Int *fi);
21EAPI int evas_common_font_get_line_advance (RGBA_Font *fn); 23EAPI int evas_common_font_get_line_advance (RGBA_Font *fn);
22 24
23/* draw */ 25/* draw */
diff --git a/src/lib/evas/common/evas_font_main.c b/src/lib/evas/common/evas_font_main.c
index 23ba95b0fc..32c7e379b1 100644
--- a/src/lib/evas/common/evas_font_main.c
+++ b/src/lib/evas/common/evas_font_main.c
@@ -230,6 +230,62 @@ evas_common_font_get_line_advance(RGBA_Font *fn)
230// return ret; 230// return ret;
231} 231}
232 232
233EAPI int
234evas_common_font_instance_underline_position_get(RGBA_Font_Int *fi)
235{
236 int position = 0;
237
238 if (!fi) goto end;
239
240 evas_common_font_int_reload(fi);
241 if (fi->src->current_size != fi->size)
242 {
243 FTLOCK();
244 FT_Activate_Size(fi->ft.size);
245 FTUNLOCK();
246 fi->src->current_size = fi->size;
247 }
248
249 position = FT_MulFix(fi->src->ft.face->underline_position,
250 fi->src->ft.face->size->metrics.x_scale);
251 position = FONT_METRIC_ROUNDUP(abs(position));
252
253end:
254 /* This almost surely means a broken font, offset at least by one pixel. */
255 if (position == 0)
256 position = 1;
257
258 return position;
259}
260
261EAPI int
262evas_common_font_instance_underline_thickness_get(RGBA_Font_Int *fi)
263{
264 int thickness = 0;
265
266 if (!fi) goto end;
267
268 evas_common_font_int_reload(fi);
269 if (fi->src->current_size != fi->size)
270 {
271 FTLOCK();
272 FT_Activate_Size(fi->ft.size);
273 FTUNLOCK();
274 fi->src->current_size = fi->size;
275 }
276
277 thickness = FT_MulFix(fi->src->ft.face->underline_thickness,
278 fi->src->ft.face->size->metrics.x_scale);
279 thickness = FONT_METRIC_ROUNDUP(thickness);
280
281end:
282 /* This almost surely means a broken font, make it at least one pixel. */
283 if (thickness == 0)
284 thickness = 1;
285
286 return thickness;
287}
288
233/* Set of common functions that are used in a couple of places. */ 289/* Set of common functions that are used in a couple of places. */
234 290
235static void 291static void