summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJiang Jiang <jiang.jiang@nokia.com>2010-11-25 16:30:32 (GMT)
committerJiang Jiang <jiang.jiang@nokia.com>2011-03-25 17:10:29 (GMT)
commit5c46d9a4c85abbcc0b5db2bbbafded3efd784cd9 (patch)
tree1e63c67e562d3ed805a0412bb688949079e32697
parent47ce3672058d4cc6ca479f8b40d6cb821c38dd51 (diff)
downloadQt-5c46d9a4c85abbcc0b5db2bbbafded3efd784cd9.zip
Qt-5c46d9a4c85abbcc0b5db2bbbafded3efd784cd9.tar.gz
Qt-5c46d9a4c85abbcc0b5db2bbbafded3efd784cd9.tar.bz2
Take Xft.hintstyle by default to match the behavior of GTK+
For Qt apps running in GNOME, we use the GTK+ settings by default (instead of fontconfig settings). Task-number: QTBUG-13800 Reviewed-by: Samuel
-rw-r--r--src/gui/kernel/qapplication_x11.cpp4
-rw-r--r--src/gui/text/qfontengine_x11.cpp7
2 files changed, 10 insertions, 1 deletions
diff --git a/src/gui/kernel/qapplication_x11.cpp b/src/gui/kernel/qapplication_x11.cpp
index 589b12e..31f70c7 100644
--- a/src/gui/kernel/qapplication_x11.cpp
+++ b/src/gui/kernel/qapplication_x11.cpp
@@ -1587,6 +1587,9 @@ static void getXDefault(const char *group, const char *key, int *val)
int v = strtol(str, &end, 0);
if (str != end)
*val = v;
+ // otherwise use fontconfig to convert the string to integer
+ else
+ FcNameConstant((FcChar8 *) str, val);
}
}
@@ -2237,6 +2240,7 @@ void qt_init(QApplicationPrivate *priv, int,
}
getXDefault("Xft", FC_ANTIALIAS, &X11->fc_antialias);
#ifdef FC_HINT_STYLE
+ X11->fc_hint_style = -1;
getXDefault("Xft", FC_HINT_STYLE, &X11->fc_hint_style);
#endif
#if 0
diff --git a/src/gui/text/qfontengine_x11.cpp b/src/gui/text/qfontengine_x11.cpp
index e442471..9f3f8d3 100644
--- a/src/gui/text/qfontengine_x11.cpp
+++ b/src/gui/text/qfontengine_x11.cpp
@@ -1029,7 +1029,12 @@ QFontEngineX11FT::QFontEngineX11FT(FcPattern *pattern, const QFontDef &fd, int s
#ifdef FC_HINT_STYLE
else {
int hint_style = 0;
- if (FcPatternGetInteger (pattern, FC_HINT_STYLE, 0, &hint_style) == FcResultNoMatch)
+ // Try to use Xft.hintstyle from XDefaults first if running in GNOME, to match
+ // the behavior of cairo
+ if (X11->fc_hint_style > -1 && X11->desktopEnvironment == DE_GNOME)
+ hint_style = X11->fc_hint_style;
+ else if (FcPatternGetInteger (pattern, FC_HINT_STYLE, 0, &hint_style) == FcResultNoMatch
+ && X11->fc_hint_style > -1)
hint_style = X11->fc_hint_style;
switch (hint_style) {