Support autohint and lcdfilter fontconfig configuration
This patch adds support for reading autohint and lcdfilter settings from fontconfig and pass them on to freetype. Task-number: QTBUG-32254 Change-Id: Iaa69b70f7005ee7f21126a8d984c07b3a46a3e7f Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@digia.com>bb10
parent
ef4a999a9f
commit
b35176f43a
|
|
@ -678,6 +678,7 @@ QFontEngineFT::QFontEngineFT(const QFontDef &fd)
|
|||
const QByteArray env = qgetenv("QT_NO_FT_CACHE");
|
||||
cacheEnabled = env.isEmpty() || env.toInt() == 0;
|
||||
m_subPixelPositionCount = 4;
|
||||
forceAutoHint = false;
|
||||
}
|
||||
|
||||
QFontEngineFT::~QFontEngineFT()
|
||||
|
|
@ -832,6 +833,9 @@ int QFontEngineFT::loadFlags(QGlyphSet *set, GlyphFormat format, int flags,
|
|||
else
|
||||
load_flags |= load_target;
|
||||
|
||||
if (forceAutoHint)
|
||||
load_flags |= FT_LOAD_FORCE_AUTOHINT;
|
||||
|
||||
return load_flags;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -307,6 +307,7 @@ protected:
|
|||
int lcdFilterType;
|
||||
bool embeddedbitmap;
|
||||
bool cacheEnabled;
|
||||
bool forceAutoHint;
|
||||
|
||||
private:
|
||||
friend class QFontEngineFTRawFont;
|
||||
|
|
|
|||
|
|
@ -624,6 +624,16 @@ QFontEngine *QFontconfigDatabase::fontEngine(const QFontDef &f, void *usrPtr)
|
|||
if (match) {
|
||||
engine->setDefaultHintStyle(defaultHintStyleFromMatch((QFont::HintingPreference)f.hintingPreference, match));
|
||||
|
||||
FcBool fc_autohint;
|
||||
if (FcPatternGetBool(match, FC_AUTOHINT,0, &fc_autohint) == FcResultMatch)
|
||||
engine->forceAutoHint = fc_autohint;
|
||||
|
||||
#if defined(FT_LCD_FILTER_H)
|
||||
int lcdFilter;
|
||||
if (FcPatternGetInteger(match, FC_LCD_FILTER, 0, &lcdFilter) == FcResultMatch)
|
||||
engine->lcdFilterType = lcdFilter;
|
||||
#endif
|
||||
|
||||
if (antialias) {
|
||||
// If antialiasing is not fully disabled, fontconfig may still disable it on a font match basis.
|
||||
FcBool fc_antialias;
|
||||
|
|
@ -685,6 +695,16 @@ QFontEngine *QFontconfigDatabase::fontEngine(const QByteArray &fontData, qreal p
|
|||
if (match) {
|
||||
engine->setDefaultHintStyle(defaultHintStyleFromMatch(hintingPreference, match));
|
||||
|
||||
FcBool fc_autohint;
|
||||
if (FcPatternGetBool(match, FC_AUTOHINT,0, &fc_autohint) == FcResultMatch)
|
||||
engine->forceAutoHint = fc_autohint;
|
||||
|
||||
#if defined(FT_LCD_FILTER_H)
|
||||
int lcdFilter;
|
||||
if (FcPatternGetInteger(match, FC_LCD_FILTER, 0, &lcdFilter) == FcResultMatch)
|
||||
engine->lcdFilterType = lcdFilter;
|
||||
#endif
|
||||
|
||||
FcBool fc_antialias;
|
||||
if (FcPatternGetBool(match, FC_ANTIALIAS,0, &fc_antialias) != FcResultMatch)
|
||||
fc_antialias = true;
|
||||
|
|
|
|||
Loading…
Reference in New Issue