From 2a4dd69499cb85695ede86ac7244fe6e1c274834 Mon Sep 17 00:00:00 2001 From: Eskil Abrahamsen Blomfeldt Date: Wed, 27 Nov 2019 12:49:37 +0100 Subject: CoreText: Fix getting system fonts on recent macOS/iOS versions MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit We introduced a work-around for iOS 11 which breaks on more recent OS versions because we try to request meta-fonts by name instead of using the special system font descriptors. This would cause warnings on the console and Times New Roman when requesting e.g. the system fixed width font. When testing on iOS 12 without the work-around, we are no longer able to reproduce the original issue, so the assumption is that this problem has been resolved. Since iOS 11 is not a supported target for Qt 5.14 we can remove the work-around entirely. [ChangeLog][macOS/iOS] Fixed a bug where QFontDatabase::systemFont() would return the wrong fonts on macOS 10.15 and iOS 13. Fixes: QTBUG-79900 Change-Id: Ie375c8c2ab877d6d66e3696662c4939f639a6e9e Reviewed-by: Tor Arne Vestbø --- .../fontdatabases/mac/qcoretextfontdatabase.mm | 11 ----------- 1 file changed, 11 deletions(-) (limited to 'src') diff --git a/src/platformsupport/fontdatabases/mac/qcoretextfontdatabase.mm b/src/platformsupport/fontdatabases/mac/qcoretextfontdatabase.mm index daa3dc94ea..894919a1c8 100644 --- a/src/platformsupport/fontdatabases/mac/qcoretextfontdatabase.mm +++ b/src/platformsupport/fontdatabases/mac/qcoretextfontdatabase.mm @@ -374,17 +374,6 @@ QFontEngine *QCoreTextFontDatabaseEngineFactory::fontEngine QCFType descriptor = QCFType::constructFromGet( static_cast(usrPtr)); - // CoreText will sometimes invalidate information in font descriptors that refer - // to system fonts in certain function calls or application states. While the descriptor - // looks the same from the outside, some internal plumbing is different, causing the results - // of creating CTFonts from those descriptors unreliable. The work-around for this - // is to copy the attributes of those descriptors each time we make a new CTFont - // from them instead of referring to the original, as that may trigger the CoreText bug. - if (m_systemFontDescriptors.contains(descriptor)) { - QCFType attributes = CTFontDescriptorCopyAttributes(descriptor); - descriptor = CTFontDescriptorCreateWithAttributes(attributes); - } - // Since we do not pass in the destination DPI to CoreText when making // the font, we need to pass in a point size which is scaled to include // the DPI. The default DPI for the screen is 72, thus the scale factor -- cgit v1.2.3