UIKit: Don't populate font families with no matching fonts
[UIFont familyNames] will return a list of fonts that include the fonts Telugu Sangam MN, Heiti SC, Heiti TC, and Bangla Sangam MN, but when calling [UIFont fontNamesForFamilyName:] for these fonts we get an empty list. The problem appeared when we tried to then populate these fonts, as CTFontDescriptorCreateMatchingFontDescriptors() would return a list of font descriptors from the PingFang SC font when called with NSFontFamilyAttribute = "Heiti SC". This is due to PingFang being a replacement for Heiti in later iOS versions. Task-number: QTBUG-50624 Change-Id: I22684e247d472c30775321b6976b3aeb6ea579f5 Reviewed-by: Jake Petroules <jake.petroules@qt.io>
This commit is contained in:
parent
91bf773b18
commit
e5e93345c5
@ -206,6 +206,12 @@ void QCoreTextFontDatabase::populateFontDatabase()
|
||||
if (familyName.startsWith(QLatin1Char('.')) || familyName == QLatin1String("LastResort"))
|
||||
continue;
|
||||
|
||||
#if defined(Q_OS_IOS) || defined(Q_OS_TVOS)
|
||||
// Skip font families with no corresponding fonts
|
||||
if (![UIFont fontNamesForFamilyName:(NSString*)familyNameRef].count)
|
||||
continue;
|
||||
#endif
|
||||
|
||||
QPlatformFontDatabase::registerFontFamily(familyName);
|
||||
|
||||
#if defined(Q_OS_OSX)
|
||||
|
Loading…
x
Reference in New Issue
Block a user