From b634305c6740dc056bbe994d6250abd2572e8c31 Mon Sep 17 00:00:00 2001 From: Uoti Urpala Date: Mon, 6 May 2013 17:35:17 +0300 Subject: fontconfig: remove default "lang" setting from patterns Fontconfig defaults set the "lang" value in patterns, and it then prefers fonts which are listed as supporting this language. The default value may not match actual script language, and even a setting of "en" for English subtitle can cause problems. Remove the "lang" setting from patterns used to find fonts. A file had a normal and an oblique version of the same font attached, with different character set coverage: the normal version lacked some non-ascii characters that fontconfig includes in its list of characters required for English support. As a result, the oblique version was picked for what was supposed to be normal text. --- libass/ass_fontconfig.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/libass/ass_fontconfig.c b/libass/ass_fontconfig.c index 33ef976..d3dddea 100644 --- a/libass/ass_fontconfig.c +++ b/libass/ass_fontconfig.c @@ -179,6 +179,14 @@ static char *select_font(ASS_Library *library, FCInstance *priv, rc = FcConfigSubstitute(priv->config, pat, FcMatchPattern); if (!rc) goto error; + /* Fontconfig defaults include a language setting, which it sets based on + * some environment variables or defaults to "en". Unset this as we don't + * know the real language, and because some some attached fonts lack + * non-ascii characters included in fontconfig's list of characters + * required for English support and therefore don't match the lang=en + * criterion. + */ + FcPatternDel(pat, "lang"); fsorted = FcFontSort(priv->config, pat, FcTrue, NULL, &result); ffullname = match_fullname(library, priv, family, bold, italic); -- cgit v1.2.3