diff options
author | Uoti Urpala <uau@glyph.nonexistent.invalid> | 2009-12-18 18:54:42 +0200 |
---|---|---|
committer | Uoti Urpala <uau@glyph.nonexistent.invalid> | 2009-12-18 18:54:42 +0200 |
commit | efcc9ad7120e01a17fc3659cb0229135b1cebb95 (patch) | |
tree | eb15edb75377eedd5d7397209e8c0d594020663e /libvo/font_load_ft.c | |
parent | 1598302be65c77c107330dc46fd0dabface3112d (diff) | |
parent | 8fcbe5835d038649e70da410d46c4f5cd502c261 (diff) | |
download | mpv-efcc9ad7120e01a17fc3659cb0229135b1cebb95.tar.bz2 mpv-efcc9ad7120e01a17fc3659cb0229135b1cebb95.tar.xz |
Merge svn changes up to r30055
Diffstat (limited to 'libvo/font_load_ft.c')
-rw-r--r-- | libvo/font_load_ft.c | 41 |
1 files changed, 23 insertions, 18 deletions
diff --git a/libvo/font_load_ft.c b/libvo/font_load_ft.c index ae2c6cc2ba..1ddd15d268 100644 --- a/libvo/font_load_ft.c +++ b/libvo/font_load_ft.c @@ -1144,6 +1144,7 @@ void load_font_ft(int width, int height, font_desc_t** fontp, const char *font_n FcChar8 *s; int face_index; FcBool scalable; + FcResult result; #endif font_desc_t *vo_font = *fontp; vo_image_width = width; @@ -1162,25 +1163,29 @@ void load_font_ft(int width, int height, font_desc_t** fontp, const char *font_n FcConfigSubstitute(0, fc_pattern, FcMatchPattern); FcDefaultSubstitute(fc_pattern); fc_pattern2 = fc_pattern; - fc_pattern = FcFontMatch(0, fc_pattern, 0); - FcPatternDestroy(fc_pattern2); - FcPatternGetBool(fc_pattern, FC_SCALABLE, 0, &scalable); - if (scalable != FcTrue) { - FcPatternDestroy(fc_pattern); - fc_pattern = FcNameParse("sans-serif"); - FcConfigSubstitute(0, fc_pattern, FcMatchPattern); - FcDefaultSubstitute(fc_pattern); - fc_pattern2 = fc_pattern; - fc_pattern = FcFontMatch(0, fc_pattern, 0); - FcPatternDestroy(fc_pattern2); - } - // s doesn't need to be freed according to fontconfig docs - FcPatternGetString(fc_pattern, FC_FILE, 0, &s); - FcPatternGetInteger(fc_pattern, FC_INDEX, 0, &face_index); - *fontp=read_font_desc_ft(s, face_index, width, height, font_scale_factor); - FcPatternDestroy(fc_pattern); + fc_pattern = FcFontMatch(0, fc_pattern, &result); + if (fc_pattern) { + FcPatternDestroy(fc_pattern2); + FcPatternGetBool(fc_pattern, FC_SCALABLE, 0, &scalable); + if (scalable != FcTrue) { + FcPatternDestroy(fc_pattern); + fc_pattern = FcNameParse("sans-serif"); + FcConfigSubstitute(0, fc_pattern, FcMatchPattern); + FcDefaultSubstitute(fc_pattern); + fc_pattern2 = fc_pattern; + fc_pattern = FcFontMatch(0, fc_pattern, 0); + FcPatternDestroy(fc_pattern2); + } + // s doesn't need to be freed according to fontconfig docs + FcPatternGetString(fc_pattern, FC_FILE, 0, &s); + FcPatternGetInteger(fc_pattern, FC_INDEX, 0, &face_index); + *fontp=read_font_desc_ft(s, face_index, width, height, font_scale_factor); + FcPatternDestroy(fc_pattern); + return; + } + mp_tmsg(MSGT_OSD, MSGL_ERR, "Fontconfig failed to select a font. " + "Trying without fontconfig...\n"); } - else #endif *fontp=read_font_desc_ft(font_name, 0, width, height, font_scale_factor); } |