summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndy Shaw <andy.shaw@qt.io>2017-02-20 14:52:29 +0100
committerAndy Shaw <andy.shaw@qt.io>2018-01-24 13:48:09 +0000
commita5810375bff382b9a578b6b655125cb7714a2bc1 (patch)
tree5cfde4e3f4d6d62f643267e11706020b32653502
parentc4b596fb7902abfb9d53e7819612b9a83ac5a8d6 (diff)
CoreText: Add Apple Symbols as a fallback to cover some symbols
Since braille characters are not included in Apple Unicode MS, we extend the fallback to include Apple Symbols to cover those too. Task-number: QTBUG-63510 Change-Id: I3977f1f9b7370a9fe9cfde643c86518e006c050a Reviewed-by: Konstantin Ritt <ritt.ks@gmail.com> Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
-rw-r--r--src/platformsupport/fontdatabases/mac/qcoretextfontdatabase.mm37
1 files changed, 19 insertions, 18 deletions
diff --git a/src/platformsupport/fontdatabases/mac/qcoretextfontdatabase.mm b/src/platformsupport/fontdatabases/mac/qcoretextfontdatabase.mm
index 7397312820..722a53ac20 100644
--- a/src/platformsupport/fontdatabases/mac/qcoretextfontdatabase.mm
+++ b/src/platformsupport/fontdatabases/mac/qcoretextfontdatabase.mm
@@ -507,6 +507,23 @@ static QString familyNameFromPostScriptName(NSString *psName)
}
#endif
+static void addExtraFallbacks(QStringList *fallbackList)
+{
+#if defined(Q_OS_MACOS)
+ // Since we are only returning a list of default fonts for the current language, we do not
+ // cover all unicode completely. This was especially an issue for some of the common script
+ // symbols such as mathematical symbols, currency or geometric shapes. To minimize the risk
+ // of missing glyphs, we add Arial Unicode MS as a final fail safe, since this covers most
+ // of Unicode 2.1.
+ if (!fallbackList->contains(QStringLiteral("Arial Unicode MS")))
+ fallbackList->append(QStringLiteral("Arial Unicode MS"));
+ // Since some symbols (specifically Braille) are not in Arial Unicode MS, we
+ // add Apple Symbols to cover those too.
+ if (!fallbackList->contains(QStringLiteral("Apple Symbols")))
+ fallbackList->append(QStringLiteral("Apple Symbols"));
+#endif
+}
+
QStringList QCoreTextFontDatabase::fallbacksForFamily(const QString &family, QFont::Style style, QFont::StyleHint styleHint, QChar::Script script) const
{
Q_UNUSED(style);
@@ -534,16 +551,7 @@ QStringList QCoreTextFontDatabase::fallbacksForFamily(const QString &family, QFo
fallbackList.append(QString::fromCFString(fallbackFamilyName));
}
-#if defined(Q_OS_OSX)
- // Since we are only returning a list of default fonts for the current language, we do not
- // cover all unicode completely. This was especially an issue for some of the common script
- // symbols such as mathematical symbols, currency or geometric shapes. To minimize the risk
- // of missing glyphs, we add Arial Unicode MS as a final fail safe, since this covers most
- // of Unicode 2.1.
- if (!fallbackList.contains(QStringLiteral("Arial Unicode MS")))
- fallbackList.append(QStringLiteral("Arial Unicode MS"));
-#endif
-
+ addExtraFallbacks(&fallbackList);
extern QStringList qt_sort_families_by_writing_system(QChar::Script, const QStringList &);
fallbackList = qt_sort_families_by_writing_system(script, fallbackList);
@@ -584,14 +592,7 @@ QStringList QCoreTextFontDatabase::fallbacksForFamily(const QString &family, QFo
fallbackList.append(QLatin1String("Apple Color Emoji"));
- // Since we are only returning a list of default fonts for the current language, we do not
- // cover all unicode completely. This was especially an issue for some of the common script
- // symbols such as mathematical symbols, currency or geometric shapes. To minimize the risk
- // of missing glyphs, we add Arial Unicode MS as a final fail safe, since this covers most
- // of Unicode 2.1.
- if (!fallbackList.contains(QStringLiteral("Arial Unicode MS")))
- fallbackList.append(QStringLiteral("Arial Unicode MS"));
-
+ addExtraFallbacks(&fallbackList);
fallbackLists[styleLookupKey.arg(fallbackStyleHint)] = fallbackList;
}
#else