summaryrefslogtreecommitdiffstats
path: root/src/platformsupport/fontdatabases/mac/qcoretextfontdatabase_p.h
diff options
context:
space:
mode:
authorTor Arne Vestbø <tor.arne.vestbo@qt.io>2016-12-02 12:44:16 +0100
committerTor Arne Vestbø <tor.arne.vestbo@qt.io>2016-12-08 16:38:01 +0000
commit50cb2687b2864acf66586fab9dd56716ebda4e9d (patch)
tree75dec7142ac92a9873de2ef3d890bbdd9f5c9a13 /src/platformsupport/fontdatabases/mac/qcoretextfontdatabase_p.h
parent2488f34ecfd68702b5508c50cca3fb8e967ac8ea (diff)
UIKit: Improve handling of private system fonts / fallback fonts
Commit 2bc7a40048 taught the CoreText font database to populate the families lazily, and in the process added a guard to ensure that we didn't populate internal fonts (prefixed with a '.'), as these fonts would then show up in font selection dialogs. Commit 909d3f5c7 then added support for private fonts, by making it possible to filter out any private fonts from font selection daialogs. But the guard was not removed, so we were still not populating these fonts. This guard has been removed, and the filtering function has been updated to include the conditions of the guard. Next, commit e5e93345c5 used [UIFont fontNamesForFamilyName:] to verify that each family that we registered with the font database would also have matching fonts when finally populated. This is not the right approach, as [UIFont fontNamesForFamilyName:] does not handle internal fonts. Instead we trust what CTFontDescriptorCreateMatchingFontDescriptors() gives us, but make sure to register the resulting font descriptors with the original/originating font family, instead of the one we pull out of the font descriptor. Finally, as of iOS 10, we can use CTFontManagerCopyAvailableFontFamilyNames instead of [UIFont familyNames], which gives us all of the internal font families like on macOS, instead of just the user-visible families. For earlier iOS versions we manually add '.PhoneFallback', as we know it will be available even if not listed in [UIFont familyNames]. The end result is that we register and populate families like '.PhoneFallback', which is critical to supporting more esoteric writing systems. The check in tst_QFont that styles for a given family is not empty has been removed, as we can't guarantee that on all platforms, which is also documented for QFontDatabase::styles(). Task-number: QTBUG-45746 Task-number: QTBUG-50624 Change-Id: I04674dcb2bb36b4cdf5646d540c35727ff3daaad Reviewed-by: Jake Petroules <jake.petroules@qt.io>
Diffstat (limited to 'src/platformsupport/fontdatabases/mac/qcoretextfontdatabase_p.h')
-rw-r--r--src/platformsupport/fontdatabases/mac/qcoretextfontdatabase_p.h2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/platformsupport/fontdatabases/mac/qcoretextfontdatabase_p.h b/src/platformsupport/fontdatabases/mac/qcoretextfontdatabase_p.h
index 1bc3522bda..3b1be2e6a1 100644
--- a/src/platformsupport/fontdatabases/mac/qcoretextfontdatabase_p.h
+++ b/src/platformsupport/fontdatabases/mac/qcoretextfontdatabase_p.h
@@ -92,7 +92,7 @@ public:
const QHash<QPlatformTheme::Font, QFont *> &themeFonts() const;
private:
- void populateFromDescriptor(CTFontDescriptorRef font);
+ void populateFromDescriptor(CTFontDescriptorRef font, const QString &familyName = QString());
#ifndef QT_NO_FREETYPE
bool m_useFreeType;