summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorJiang Jiang <jiang.jiang@nokia.com>2010-11-25 16:30:32 (GMT)
committerQt Commercial Integration <QtCommercial@digia.com>2012-01-31 10:24:59 (GMT)
commitea0dfd8bb37ba9e279ae760563044df23c733804 (patch)
treef9be51451094b87aab7b43f5cec89d255a264894 /src
parentd4cd998fecb5f005a5d02fcfe1514bad2a0baa6b (diff)
downloadQt-ea0dfd8bb37ba9e279ae760563044df23c733804.zip
Qt-ea0dfd8bb37ba9e279ae760563044df23c733804.tar.gz
Qt-ea0dfd8bb37ba9e279ae760563044df23c733804.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
Diffstat (limited to 'src')
-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 6d13628..a8ff726 100644
--- a/src/gui/kernel/qapplication_x11.cpp
+++ b/src/gui/kernel/qapplication_x11.cpp
@@ -1589,6 +1589,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);
}
}
@@ -2233,6 +2236,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 5ee9829..f95c983 100644
--- a/src/gui/text/qfontengine_x11.cpp
+++ b/src/gui/text/qfontengine_x11.cpp
@@ -1015,7 +1015,12 @@ QFontEngineX11FT::QFontEngineX11FT(FcPattern *pattern, const QFontDef &fd, int s
#ifdef FC_HINT_STYLE
{
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) {