Only use Xft font settings as defaults, and let fontconfig override

On a GNOME or UNITY desktop, Qt will currently read font-settings from
Xft and use those ignoring any fontconfig instructions. This patch
changes the behavior so the Xft settings are only used as default, but
any explicit overrides by fontconfig will take precedence.

Task-number: QTBUG-43660
Change-Id: Ie10d5828cbfdd95fe5364c63a625d455d9213936
Reviewed-by: Konstantin Ritt <ritt.ks@gmail.com>
Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@theqtcompany.com>
This commit is contained in:
Allan Sandfeld Jensen 2015-01-21 14:36:02 +01:00
parent 55162dae7e
commit 2e2df81537

View File

@ -526,18 +526,8 @@ QFontEngine::HintStyle defaultHintStyleFromMatch(QFont::HintingPreference hintin
return QFontEngine::HintNone;
}
if (useXftConf) {
void *hintStyleResource =
QGuiApplication::platformNativeInterface()->nativeResourceForScreen("hintstyle",
QGuiApplication::primaryScreen());
int hintStyle = int(reinterpret_cast<qintptr>(hintStyleResource));
if (hintStyle > 0)
return QFontEngine::HintStyle(hintStyle - 1);
}
int hint_style = 0;
if (FcPatternGetInteger (match, FC_HINT_STYLE, 0, &hint_style) == FcResultNoMatch)
hint_style = FC_HINT_FULL;
if (FcPatternGetInteger (match, FC_HINT_STYLE, 0, &hint_style) == FcResultMatch) {
switch (hint_style) {
case FC_HINT_NONE:
return QFontEngine::HintNone;
@ -551,23 +541,24 @@ QFontEngine::HintStyle defaultHintStyleFromMatch(QFont::HintingPreference hintin
Q_UNREACHABLE();
break;
}
}
if (useXftConf) {
void *hintStyleResource =
QGuiApplication::platformNativeInterface()->nativeResourceForScreen("hintstyle",
QGuiApplication::primaryScreen());
int hintStyle = int(reinterpret_cast<qintptr>(hintStyleResource));
if (hintStyle > 0)
return QFontEngine::HintStyle(hintStyle - 1);
}
return QFontEngine::HintFull;
}
QFontEngine::SubpixelAntialiasingType subpixelTypeFromMatch(FcPattern *match, bool useXftConf)
{
if (useXftConf) {
void *subpixelTypeResource =
QGuiApplication::platformNativeInterface()->nativeResourceForScreen("subpixeltype",
QGuiApplication::primaryScreen());
int subpixelType = int(reinterpret_cast<qintptr>(subpixelTypeResource));
if (subpixelType > 0)
return QFontEngine::SubpixelAntialiasingType(subpixelType - 1);
}
int subpixel = FC_RGBA_UNKNOWN;
FcPatternGetInteger(match, FC_RGBA, 0, &subpixel);
if (FcPatternGetInteger(match, FC_RGBA, 0, &subpixel) == FcResultMatch) {
switch (subpixel) {
case FC_RGBA_UNKNOWN:
case FC_RGBA_NONE:
@ -584,6 +575,17 @@ QFontEngine::SubpixelAntialiasingType subpixelTypeFromMatch(FcPattern *match, bo
Q_UNREACHABLE();
break;
}
}
if (useXftConf) {
void *subpixelTypeResource =
QGuiApplication::platformNativeInterface()->nativeResourceForScreen("subpixeltype",
QGuiApplication::primaryScreen());
int subpixelType = int(reinterpret_cast<qintptr>(subpixelTypeResource));
if (subpixelType > 0)
return QFontEngine::SubpixelAntialiasingType(subpixelType - 1);
}
return QFontEngine::Subpixel_None;
}
} // namespace
@ -823,10 +825,8 @@ void QFontconfigDatabase::setupFontEngine(QFontEngineFT *engine, const QFontDef
QGuiApplication::platformNativeInterface()->nativeResourceForScreen("antialiasingEnabled",
QGuiApplication::primaryScreen());
int antialiasingEnabled = int(reinterpret_cast<qintptr>(antialiasResource));
if (antialiasingEnabled > 0) {
if (antialiasingEnabled > 0)
antialias = antialiasingEnabled - 1;
forcedAntialiasSetting = true;
}
}
QFontEngine::GlyphFormat format;