diff options
author | Jørgen Lind <jorgen.lind@nokia.com> | 2010-12-06 15:05:55 (GMT) |
---|---|---|
committer | Jørgen Lind <jorgen.lind@nokia.com> | 2011-01-04 14:20:11 (GMT) |
commit | 06568ff89c48dee8aab278b8b0538c331aa84595 (patch) | |
tree | a46fd8406e0661ec5e5b4ddbf1ef3e2562175a36 /src/gui/text/qfontdatabase_qpa.cpp | |
parent | 0ceed999bbf25d19b3ded8a1b300cf0c6129f775 (diff) | |
download | Qt-06568ff89c48dee8aab278b8b0538c331aa84595.zip Qt-06568ff89c48dee8aab278b8b0538c331aa84595.tar.gz Qt-06568ff89c48dee8aab278b8b0538c331aa84595.tar.bz2 |
Add styleHint to fallback api for fontdatabases in Lighthouse
Diffstat (limited to 'src/gui/text/qfontdatabase_qpa.cpp')
-rw-r--r-- | src/gui/text/qfontdatabase_qpa.cpp | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/src/gui/text/qfontdatabase_qpa.cpp b/src/gui/text/qfontdatabase_qpa.cpp index e54093c..e6d99c6 100644 --- a/src/gui/text/qfontdatabase_qpa.cpp +++ b/src/gui/text/qfontdatabase_qpa.cpp @@ -80,9 +80,9 @@ Q_GUI_EXPORT void qt_registerFont(const QString &familyName, const QString &fou size->handle = handle; } -static QStringList fallbackFamilies(const QString &family, const QFont::Style &style, const QUnicodeTables::Script &script) +static QStringList fallbackFamilies(const QString &family, const QFont::Style &style, const QFont::StyleHint &styleHint, const QUnicodeTables::Script &script) { - QStringList retList = QApplicationPrivate::platformIntegration()->fontDatabase()->fallbacksForFamily(family,style,script); + QStringList retList = QApplicationPrivate::platformIntegration()->fontDatabase()->fallbacksForFamily(family,style,styleHint,script); QFontDatabasePrivate *db = privateDb(); QStringList::iterator i; @@ -177,7 +177,11 @@ QFontEngine *loadEngine(int script, const QFontDef &request, && !(request.styleStrategy & QFont::NoFontMerging) && !engine->symbol ) { if (family && !family->askedForFallback) { - family->fallbackFamilies = fallbackFamilies(family->name,QFont::Style(style->key.style),QUnicodeTables::Script(script)); + QFont::Style fontStyle = QFont::Style(style->key.style); + QFont::StyleHint styleHint = QFont::StyleHint(request.styleHint); + if (styleHint == QFont::AnyStyle && request.fixedPitch) + styleHint = QFont::TypeWriter; + family->fallbackFamilies = fallbackFamilies(family->name,fontStyle,styleHint,QUnicodeTables::Script(script)); family->askedForFallback = true; } @@ -287,7 +291,7 @@ QFontDatabase::findFont(int script, const QFontPrivate *fp, if (!engine) { if (!request.family.isEmpty()) { - QStringList fallbacks = fallbackFamilies(request.family,QFont::Style(request.style),QUnicodeTables::Script(script)); + QStringList fallbacks = fallbackFamilies(request.family,QFont::Style(request.style),QFont::StyleHint(request.styleHint),QUnicodeTables::Script(script)); for (int i = 0; i < fallbacks.size(); i++) { QFontDef def = request; def.family = fallbacks.at(i); |