REG: Fix font matching in FontConfig

Change a4ff400e25 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 <simon.hausmann@digia.com>
Reviewed-by: Konstantin Ritt <ritt.ks@gmail.com>
This commit is contained in:
Eskil Abrahamsen Blomfeldt 2014-01-29 11:57:08 +01:00 committed by The Qt Project
parent ff70c39ebc
commit b04d87b226

View File

@ -547,6 +547,10 @@ QFontEngine *QFontconfigDatabase::fontEngine(const QFontDef &f, QChar::Script sc
FcPatternAdd(pattern,FC_INDEX,value,true); FcPatternAdd(pattern,FC_INDEX,value,true);
FcResult result; FcResult result;
FcConfigSubstitute(0, pattern, FcMatchPattern);
FcDefaultSubstitute(pattern);
FcPattern *match = FcFontMatch(0, pattern, &result); FcPattern *match = FcFontMatch(0, pattern, &result);
QFontEngineFT *engine = new QFontEngineFT(fontDef); QFontEngineFT *engine = new QFontEngineFT(fontDef);