summaryrefslogtreecommitdiffstats
path: root/src/gui
diff options
context:
space:
mode:
authorEskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>2016-10-25 11:56:33 +0200
committerEskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>2016-10-26 09:40:30 +0000
commitaa2e2a8d5e4712d93879098675c0a46df0fd7a41 (patch)
tree01af45292898aca0a8a0dc3659ad0168cf3ffa4c /src/gui
parent78ee77f49122ac525590715a0a034965e3e59adf (diff)
Android: Fix synthesized oblique for non-latin scripts
In 5e3e34731b7880ac775e8f1fa156ce016e6820f1, a default implementation of QPlatformFontDatabase::fallbacksForFamily() was added, but this implementation included only the fonts with a matching style in the returned list. The result of this was that if a font face for a specific language did not have e.g. an italic font, then we would show missing glyph boxes instead. On Android, it would be impossible to show any italic text in Chinese, Japanese, Hebrew, or Arabic. [ChangeLog][QtGui][Text] Fixed synthesized oblique for non-latin text on platforms using the basic font database, such as Android. Task-number: QTBUG-51223 Change-Id: I494d8ad87292b65d4380a2e600c1c0dc7fc8f937 Reviewed-by: Lars Knoll <lars.knoll@qt.io> Reviewed-by: Konstantin Ritt <ritt.ks@gmail.com>
Diffstat (limited to 'src/gui')
-rw-r--r--src/gui/text/qfontdatabase.cpp19
1 files changed, 10 insertions, 9 deletions
diff --git a/src/gui/text/qfontdatabase.cpp b/src/gui/text/qfontdatabase.cpp
index 04081a5ca7..f1b2e84a1e 100644
--- a/src/gui/text/qfontdatabase.cpp
+++ b/src/gui/text/qfontdatabase.cpp
@@ -805,7 +805,8 @@ QStringList QPlatformFontDatabase::fallbacksForFamily(const QString &family, QFo
Q_UNUSED(family);
Q_UNUSED(styleHint);
- QStringList retList;
+ QStringList preferredFallbacks;
+ QStringList otherFallbacks;
size_t writingSystem = std::find(scriptForWritingSystem,
scriptForWritingSystem + QFontDatabase::WritingSystemsCount,
@@ -826,18 +827,18 @@ QStringList QPlatformFontDatabase::fallbacksForFamily(const QString &family, QFo
QtFontFoundry *foundry = f->foundries[j];
for (int k = 0; k < foundry->count; ++k) {
- if (style == foundry->styles[k]->key.style) {
- if (foundry->name.isEmpty())
- retList.append(f->name);
- else
- retList.append(f->name + QLatin1String(" [") + foundry->name + QLatin1Char(']'));
- break;
- }
+ QString name = foundry->name.isEmpty()
+ ? f->name
+ : f->name + QLatin1String(" [") + foundry->name + QLatin1Char(']');
+ if (style == foundry->styles[k]->key.style)
+ preferredFallbacks.append(name);
+ else
+ otherFallbacks.append(name);
}
}
}
- return retList;
+ return preferredFallbacks + otherFallbacks;
}
static void initializeDb();