From e5e93345c5befc1d0891bdf53db4d7d2ccfc8cd0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tor=20Arne=20Vestb=C3=B8?= Date: Wed, 8 Jun 2016 16:47:31 +0200 Subject: 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 --- src/platformsupport/fontdatabases/mac/qcoretextfontdatabase.mm | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'src/platformsupport') diff --git a/src/platformsupport/fontdatabases/mac/qcoretextfontdatabase.mm b/src/platformsupport/fontdatabases/mac/qcoretextfontdatabase.mm index c75bf4cf02..0b9e7a7fe0 100644 --- a/src/platformsupport/fontdatabases/mac/qcoretextfontdatabase.mm +++ b/src/platformsupport/fontdatabases/mac/qcoretextfontdatabase.mm @@ -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) -- cgit v1.2.3