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>
This commit is contained in:
parent
1e41e9b77d
commit
a614bc6e39
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user