Windows: Respect hinting preferences with FreeType engine.
One of the fontEngine()'s methods was missing hinting. This bug only manifests on Windows because on Linux QFontConfigDataBase already sets hinting on both code paths. Task-number: QTBUG-42534 Change-Id: I3a66a9d4aaa5e390fee305a3d5aacfeba38a1fc3 Reviewed-by: Konstantin Ritt <ritt.ks@gmail.com>
This commit is contained in:
parent
23517bfc35
commit
6593531a4d
@ -106,6 +106,24 @@ void QBasicFontDatabase::populateFontDatabase()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
inline static void setHintingPreference(QFontEngine *engine, QFont::HintingPreference hintingPreference)
|
||||||
|
{
|
||||||
|
switch (hintingPreference) {
|
||||||
|
case QFont::PreferNoHinting:
|
||||||
|
engine->setDefaultHintStyle(QFontEngineFT::HintNone);
|
||||||
|
break;
|
||||||
|
case QFont::PreferFullHinting:
|
||||||
|
engine->setDefaultHintStyle(QFontEngineFT::HintFull);
|
||||||
|
break;
|
||||||
|
case QFont::PreferVerticalHinting:
|
||||||
|
engine->setDefaultHintStyle(QFontEngineFT::HintLight);
|
||||||
|
break;
|
||||||
|
case QFont::PreferDefaultHinting:
|
||||||
|
// Leave it as it is
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
QFontEngine *QBasicFontDatabase::fontEngine(const QFontDef &fontDef, void *usrPtr)
|
QFontEngine *QBasicFontDatabase::fontEngine(const QFontDef &fontDef, void *usrPtr)
|
||||||
{
|
{
|
||||||
FontFile *fontfile = static_cast<FontFile *> (usrPtr);
|
FontFile *fontfile = static_cast<FontFile *> (usrPtr);
|
||||||
@ -120,6 +138,8 @@ QFontEngine *QBasicFontDatabase::fontEngine(const QFontDef &fontDef, void *usrPt
|
|||||||
if (!engine->init(fid, antialias, format) || engine->invalid()) {
|
if (!engine->init(fid, antialias, format) || engine->invalid()) {
|
||||||
delete engine;
|
delete engine;
|
||||||
engine = 0;
|
engine = 0;
|
||||||
|
} else {
|
||||||
|
setHintingPreference(engine, static_cast<QFont::HintingPreference>(fontDef.hintingPreference));
|
||||||
}
|
}
|
||||||
|
|
||||||
return engine;
|
return engine;
|
||||||
@ -172,21 +192,7 @@ QFontEngine *QBasicFontDatabase::fontEngine(const QByteArray &fontData, qreal pi
|
|||||||
}
|
}
|
||||||
|
|
||||||
fe->updateFamilyNameAndStyle();
|
fe->updateFamilyNameAndStyle();
|
||||||
|
setHintingPreference(fe, hintingPreference);
|
||||||
switch (hintingPreference) {
|
|
||||||
case QFont::PreferNoHinting:
|
|
||||||
fe->setDefaultHintStyle(QFontEngineFT::HintNone);
|
|
||||||
break;
|
|
||||||
case QFont::PreferFullHinting:
|
|
||||||
fe->setDefaultHintStyle(QFontEngineFT::HintFull);
|
|
||||||
break;
|
|
||||||
case QFont::PreferVerticalHinting:
|
|
||||||
fe->setDefaultHintStyle(QFontEngineFT::HintLight);
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
// Leave it as it is
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
return fe;
|
return fe;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user