diff options
author | Tor Arne Vestbø <tor.arne.vestbo@qt.io> | 2016-06-08 16:47:31 +0200 |
---|---|---|
committer | Tor Arne Vestbø <tor.arne.vestbo@theqtcompany.com> | 2016-06-14 10:38:01 +0000 |
commit | e5e93345c5befc1d0891bdf53db4d7d2ccfc8cd0 (patch) | |
tree | 5c7182ead0aefa1d6227b6d862a67cd6f2a6b414 /src/platformsupport/fontdatabases | |
parent | 91bf773b18438d8808bc673703fa9d863ccb64f5 (diff) |
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>
Diffstat (limited to 'src/platformsupport/fontdatabases')
-rw-r--r-- | src/platformsupport/fontdatabases/mac/qcoretextfontdatabase.mm | 6 |
1 files changed, 6 insertions, 0 deletions
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) |