summaryrefslogtreecommitdiffstats
path: root/src/gui/text
diff options
context:
space:
mode:
authoraavit <qt-info@nokia.com>2011-02-28 13:55:43 (GMT)
committeraavit <qt-info@nokia.com>2011-02-28 13:55:43 (GMT)
commitc0ef39aaf2836ef5988e25a219f9bcbff2319ad2 (patch)
tree4246544c8c267d2d131dc9d7f9f759419dd2dff4 /src/gui/text
parenteedc18d1fdcf7c359916304cbf0b4629bbf70c84 (diff)
parent992f233cac66384685212e03dfa600664a23b924 (diff)
downloadQt-c0ef39aaf2836ef5988e25a219f9bcbff2319ad2.zip
Qt-c0ef39aaf2836ef5988e25a219f9bcbff2319ad2.tar.gz
Qt-c0ef39aaf2836ef5988e25a219f9bcbff2319ad2.tar.bz2
Merge branch 'master' of scm.dev.nokia.troll.no:qt/qt-fire-team
Diffstat (limited to 'src/gui/text')
-rw-r--r--src/gui/text/qfont.cpp3
-rw-r--r--src/gui/text/qfontdatabase.cpp6
-rw-r--r--src/gui/text/qfontdatabase.h1
-rw-r--r--src/gui/text/qfontdatabase_x11.cpp22
4 files changed, 32 insertions, 0 deletions
diff --git a/src/gui/text/qfont.cpp b/src/gui/text/qfont.cpp
index 084b7ac..64eb27a 100644
--- a/src/gui/text/qfont.cpp
+++ b/src/gui/text/qfont.cpp
@@ -139,6 +139,9 @@ bool QFontDef::exactMatch(const QFontDef &other) const
QFontDatabase::parseFontName(family, this_foundry, this_family);
QFontDatabase::parseFontName(other.family, other_foundry, other_family);
+ this_family = QFontDatabase::resolveFontFamilyAlias(this_family);
+ other_family = QFontDatabase::resolveFontFamilyAlias(other_family);
+
return (styleHint == other.styleHint
&& styleStrategy == other.styleStrategy
&& weight == other.weight
diff --git a/src/gui/text/qfontdatabase.cpp b/src/gui/text/qfontdatabase.cpp
index 8e92b1a..1e94bf5 100644
--- a/src/gui/text/qfontdatabase.cpp
+++ b/src/gui/text/qfontdatabase.cpp
@@ -1087,6 +1087,12 @@ QT_BEGIN_INCLUDE_NAMESPACE
#elif defined(Q_OS_SYMBIAN)
# include "qfontdatabase_s60.cpp"
#endif
+#if !defined(Q_WS_X11)
+QString QFontDatabase::resolveFontFamilyAlias(const QString &family)
+{
+ return family;
+}
+#endif
QT_END_INCLUDE_NAMESPACE
static QtFontStyle *bestStyle(QtFontFoundry *foundry, const QtFontStyle::Key &styleKey)
diff --git a/src/gui/text/qfontdatabase.h b/src/gui/text/qfontdatabase.h
index 3e9483b..ae1130e 100644
--- a/src/gui/text/qfontdatabase.h
+++ b/src/gui/text/qfontdatabase.h
@@ -152,6 +152,7 @@ public:
private:
static void createDatabase();
static void parseFontName(const QString &name, QString &foundry, QString &family);
+ static QString resolveFontFamilyAlias(const QString &family);
#if defined(Q_WS_QWS) || defined(Q_WS_QPA) || defined(Q_OS_SYMBIAN)
static QFontEngine *findFont(int script, const QFontPrivate *fp, const QFontDef &request);
#endif
diff --git a/src/gui/text/qfontdatabase_x11.cpp b/src/gui/text/qfontdatabase_x11.cpp
index f923d87..02b0148 100644
--- a/src/gui/text/qfontdatabase_x11.cpp
+++ b/src/gui/text/qfontdatabase_x11.cpp
@@ -2120,4 +2120,26 @@ bool QFontDatabase::supportsThreadedFontRendering()
#endif
}
+QString QFontDatabase::resolveFontFamilyAlias(const QString &family)
+{
+#if defined(QT_NO_FONTCONFIG)
+ return family;
+#else
+ FcPattern *pattern = FcPatternCreate();
+ if (!pattern)
+ return family;
+
+ FcPatternAddString(pattern, FC_FAMILY, (const FcChar8 *) family.toUtf8().data());
+ FcConfigSubstitute(0, pattern, FcMatchPattern);
+ FcDefaultSubstitute(pattern);
+
+ FcChar8 *familyAfterSubstitution;
+ FcPatternGetString(pattern, FC_FAMILY, 0, &familyAfterSubstitution);
+ QString resolved = QString::fromUtf8((const char *) familyAfterSubstitution);
+ FcPatternDestroy(pattern);
+
+ return resolved;
+#endif
+}
+
QT_END_NAMESPACE