summaryrefslogtreecommitdiff
path: root/src/lib/evas/common/evas_font_main.c
diff options
context:
space:
mode:
authorTom Hacohen <tom@stosb.com>2013-10-01 16:42:48 +0100
committerTom Hacohen <tom@stosb.com>2013-10-02 11:46:25 +0100
commitfca131d6fae726d3710b53c8088053c8eb6a427b (patch)
tree165f670e4f5f074a7dafa22eae10c1ff1ec5f2ad /src/lib/evas/common/evas_font_main.c
parent6a2aafeac36379bb1163bb48d992d035e89366a1 (diff)
Evas font: Added functions to query the underline properties.
This will let us query the position and thickness as requested by the font.
Diffstat (limited to '')
-rw-r--r--src/lib/evas/common/evas_font_main.c56
1 files changed, 56 insertions, 0 deletions
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