diff options
author | Qt Continuous Integration System <qt-info@nokia.com> | 2011-03-01 09:12:55 (GMT) |
---|---|---|
committer | Qt Continuous Integration System <qt-info@nokia.com> | 2011-03-01 09:12:55 (GMT) |
commit | 9b08c9f72f5308a918b3bf1702cb6292d903c651 (patch) | |
tree | ad4924fb21c131111a8f350e5249e2609760a317 /src/gui | |
parent | 54869c8727e5403cea866c99a5f83ae9c8533f82 (diff) | |
parent | dc68caf1ef408ca0d6e6619fed4c3211ade973bd (diff) | |
download | Qt-9b08c9f72f5308a918b3bf1702cb6292d903c651.zip Qt-9b08c9f72f5308a918b3bf1702cb6292d903c651.tar.gz Qt-9b08c9f72f5308a918b3bf1702cb6292d903c651.tar.bz2 |
Merge branch 'master' of scm.dev.nokia.troll.no:qt/qt-fire-staging into master-integration
* 'master' of scm.dev.nokia.troll.no:qt/qt-fire-staging:
Resolve font alias before testing for exact matching
Diffstat (limited to 'src/gui')
-rw-r--r-- | src/gui/text/qfont.cpp | 3 | ||||
-rw-r--r-- | src/gui/text/qfontdatabase.cpp | 6 | ||||
-rw-r--r-- | src/gui/text/qfontdatabase.h | 1 | ||||
-rw-r--r-- | src/gui/text/qfontdatabase_x11.cpp | 22 |
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 |