From 7e8617f090078becdd41152aecf4a71f3b33fbf3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Ekl=C3=B6f?= Date: Wed, 27 Nov 2019 21:40:02 +0100 Subject: [PATCH] font: use FT_Set_Pixel_Sizes() instead of FT_Set_Char_Size() And bail out if we fail --- font.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/font.c b/font.c index 864464a..4951113 100644 --- a/font.c +++ b/font.c @@ -201,8 +201,14 @@ from_font_set(FcPattern *pattern, FcFontSet *fonts, int start_idx, if (ft_err != 0) LOG_ERR("%s: failed to create FreeType face", face_file); - if ((ft_err = FT_Set_Char_Size(ft_face, pixel_size * 64, 0, 0, 0)) != 0) - LOG_WARN("failed to set character size"); + if ((ft_err = FT_Set_Pixel_Sizes(ft_face, 0, pixel_size)) != 0) { + LOG_WARN("failed to set pixel size"); + mtx_lock(&ft_lock); + FT_Done_Face(ft_face); + mtx_unlock(&ft_lock); + FcPatternDestroy(final_pattern); + return false; + } FcBool fc_hinting; if (FcPatternGetBool(final_pattern, FC_HINTING,0, &fc_hinting) != FcResultMatch)