CoreText: Fix getting system fonts on recent macOS/iOS versions
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ø <tor.arne.vestbo@qt.io>bb10
parent
d60b71d635
commit
2a4dd69499
|
|
@ -374,17 +374,6 @@ QFontEngine *QCoreTextFontDatabaseEngineFactory<QCoreTextFontEngine>::fontEngine
|
|||
QCFType<CTFontDescriptorRef> descriptor = QCFType<CTFontDescriptorRef>::constructFromGet(
|
||||
static_cast<CTFontDescriptorRef>(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<CFDictionaryRef> 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
|
||||
|
|
|
|||
Loading…
Reference in New Issue