summaryrefslogtreecommitdiffstats
path: root/src/platformsupport
diff options
context:
space:
mode:
authorEskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@digia.com>2014-09-15 12:14:17 +0200
committerEskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@digia.com>2014-09-18 13:42:32 +0200
commita614bc6e39c8460ebe5b7a5aff546ca3219c8730 (patch)
tree29f7e59da775a435660ed684f6063b812d3a76f2 /src/platformsupport
parent1e41e9b77d3cb8bf863c9e3b88273c2977c1ede9 (diff)
Cocoa: Always add Arial Unicode MS to fallback list
The fallbacks on the platform should ideally contain all fonts that support the script passed in, but this would require populating the font database and checking the unicode ranges for all fonts, so it would cause a significant performance hit on Mac. What we do here instead is just return a set of default fonts as the fallbacks and disregard the requested script. The consequence of this is that some special unicode codepoints were not supported on Mac, because we weren't working with a full fallback list. To rectify this without breaking performance, we always add Arial Unicode MS to the end of the fallback list as a final fallback. This should always be present on the system and has a wide support of different scripts. [ChangeLog][OS X][Fonts] Fixed missing glyph box shown in place of some uncommon Unicode code points. Change-Id: I4fc8576bfddc8a73204aca2b16437d42c524bc79 Task-number: QTBUG-40986 Task-number: QTBUG-40549 Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@digia.com>
Diffstat (limited to 'src/platformsupport')
-rw-r--r--src/platformsupport/fontdatabases/mac/qcoretextfontdatabase.mm19
1 files changed, 19 insertions, 0 deletions
diff --git a/src/platformsupport/fontdatabases/mac/qcoretextfontdatabase.mm b/src/platformsupport/fontdatabases/mac/qcoretextfontdatabase.mm
index a775f745fd..c3553c79f9 100644
--- a/src/platformsupport/fontdatabases/mac/qcoretextfontdatabase.mm
+++ b/src/platformsupport/fontdatabases/mac/qcoretextfontdatabase.mm
@@ -481,6 +481,17 @@ QStringList QCoreTextFontDatabase::fallbacksForFamily(const QString &family, QFo
QCFString fallbackFamilyName = (CFStringRef) CTFontDescriptorCopyAttribute(fontFallback, kCTFontFamilyNameAttribute);
fallbackList.append(QCFString::toQString(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
+
fallbackLists[family] = fallbackList;
}
}
@@ -524,6 +535,14 @@ QStringList QCoreTextFontDatabase::fallbacksForFamily(const QString &family, QFo
if (QCoreTextFontEngine::supportsColorGlyphs())
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"));
+
fallbackLists[styleLookupKey.arg(fallbackStyleHint)] = fallbackList;
}
#else