summaryrefslogtreecommitdiffstats
path: root/src/gui/text/qfontdatabase.cpp
diff options
context:
space:
mode:
authorEskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@digia.com>2014-07-09 09:49:59 +0200
committerEskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@digia.com>2014-07-10 10:01:49 +0200
commit1dd9a0af4f577ccb5578cea562a98686c8e290e6 (patch)
tree7c5ade01e711b2f9d9f96da3f089229b2f7101d6 /src/gui/text/qfontdatabase.cpp
parent916c9d469bd0df227dc3be97fcca27e3cf58144f (diff)
Fix fallbacks for adapted common script
When the platform plugin gives us specific fallbacks for a specific script, we need to respect this, and load the correct font family regardless of which writing systems it supports. This is especially important since the common script is adapted to match surrounding, proper scripts, so characters such as digits next to e.g. Hebrew text will be marked as Hebrew. On stock Android, there is a single Hebrew font, and this would previously be put in all fallback slots for Hebrew regardless of what fallback fonts were dictated by the platform plugin. Since this font does not support the digits, they would show up as boxes. [ChangeLog][Android] Fixed common characters like digits and punctuation showing as boxes when positioned next to non-latin scripts. Task-number: QTBUG-39377 Change-Id: I1555e208a8ddc587c0bbdbfff1600cafdd9442e9 Reviewed-by: Konstantin Ritt <ritt.ks@gmail.com>
Diffstat (limited to 'src/gui/text/qfontdatabase.cpp')
-rw-r--r--src/gui/text/qfontdatabase.cpp10
1 files changed, 5 insertions, 5 deletions
diff --git a/src/gui/text/qfontdatabase.cpp b/src/gui/text/qfontdatabase.cpp
index 06438103ad..86a0bf1066 100644
--- a/src/gui/text/qfontdatabase.cpp
+++ b/src/gui/text/qfontdatabase.cpp
@@ -596,7 +596,7 @@ struct QtFontDesc
static int match(int script, const QFontDef &request,
const QString &family_name, const QString &foundry_name, int force_encoding_id,
- QtFontDesc *desc, const QList<int> &blacklisted);
+ QtFontDesc *desc, const QList<int> &blacklisted, bool fallback);
static void initFontDef(const QtFontDesc &desc, const QFontDef &request, QFontDef *fontDef, bool multi)
{
@@ -1079,7 +1079,7 @@ static bool matchFamilyName(const QString &familyName, QtFontFamily *f)
*/
static int match(int script, const QFontDef &request,
const QString &family_name, const QString &foundry_name, int force_encoding_id,
- QtFontDesc *desc, const QList<int> &blacklistedFamilies)
+ QtFontDesc *desc, const QList<int> &blacklistedFamilies, bool fallback = false)
{
Q_UNUSED(force_encoding_id);
int result = -1;
@@ -1132,7 +1132,7 @@ static int match(int script, const QFontDef &request,
load(test.family->name, script);
// Check if family is supported in the script we want
- if (script != QChar::Script_Common && !(test.family->writingSystems[writingSystem] & QtFontFamily::Supported))
+ if (!fallback && script != QChar::Script_Common && !(test.family->writingSystems[writingSystem] & QtFontFamily::Supported))
continue;
// as we know the script is supported, we can be sure
@@ -2450,7 +2450,7 @@ bool QFontDatabase::supportsThreadedFontRendering()
*/
QFontEngine *
QFontDatabase::findFont(int script, const QFontPrivate *fp,
- const QFontDef &request, bool multi)
+ const QFontDef &request, bool multi, bool fallback)
{
QMutexLocker locker(fontDatabaseMutex());
@@ -2478,7 +2478,7 @@ QFontDatabase::findFont(int script, const QFontPrivate *fp,
QtFontDesc desc;
QList<int> blackListed;
- int index = match(script, request, family_name, foundry_name, force_encoding_id, &desc, blackListed);
+ int index = match(script, request, family_name, foundry_name, force_encoding_id, &desc, blackListed, fallback);
if (index >= 0) {
engine = loadEngine(script, request, desc.family, desc.foundry, desc.style, desc.size);
if (!engine)