summaryrefslogtreecommitdiffstats
path: root/src/gui/text/qfontdatabase_qpa.cpp
diff options
context:
space:
mode:
authorJørgen Lind <jorgen.lind@nokia.com>2010-12-06 15:05:55 (GMT)
committerJørgen Lind <jorgen.lind@nokia.com>2011-01-04 14:20:11 (GMT)
commit06568ff89c48dee8aab278b8b0538c331aa84595 (patch)
treea46fd8406e0661ec5e5b4ddbf1ef3e2562175a36 /src/gui/text/qfontdatabase_qpa.cpp
parent0ceed999bbf25d19b3ded8a1b300cf0c6129f775 (diff)
downloadQt-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.cpp12
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);