From b04d87b2263fd5d9b2b57799098a2eb5a3c91dfc Mon Sep 17 00:00:00 2001 From: Eskil Abrahamsen Blomfeldt Date: Wed, 29 Jan 2014 11:57:08 +0100 Subject: [PATCH] REG: Fix font matching in FontConfig Change a4ff400e25c76a32ec8252285dda043f07b19c15 exposed a bug in the font matching in the FontConfig engine. FcFontMatch is documented to not work unless you call FcConfigSubstitute() and FcDefaultSubstitute() on the pattern first. We were neglecting to do this, but hiding the bug before since we were doing our own font matching and never reading back the file name from FC's match. When we started doing this, suddenly DejaVu Sans (for instance) would match its bold variant instead. Change-Id: Ie6b7026de24cfb0353dc892fa862d6ee79604f38 Reviewed-by: Simon Hausmann Reviewed-by: Konstantin Ritt --- .../fontdatabases/fontconfig/qfontconfigdatabase.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/platformsupport/fontdatabases/fontconfig/qfontconfigdatabase.cpp b/src/platformsupport/fontdatabases/fontconfig/qfontconfigdatabase.cpp index 28f895f3b9a..c1ffa1b4fa4 100644 --- a/src/platformsupport/fontdatabases/fontconfig/qfontconfigdatabase.cpp +++ b/src/platformsupport/fontdatabases/fontconfig/qfontconfigdatabase.cpp @@ -547,6 +547,10 @@ QFontEngine *QFontconfigDatabase::fontEngine(const QFontDef &f, QChar::Script sc FcPatternAdd(pattern,FC_INDEX,value,true); FcResult result; + + FcConfigSubstitute(0, pattern, FcMatchPattern); + FcDefaultSubstitute(pattern); + FcPattern *match = FcFontMatch(0, pattern, &result); QFontEngineFT *engine = new QFontEngineFT(fontDef);