Branch: refs/heads/main Home: https://github.com/WebKit/WebKit Commit: 9bdb0a69c53e7c86138c20f222110df8b7ede16f https://github.com/WebKit/WebKit/commit/9bdb0a69c53e7c86138c20f222110df8b7ede16f Author: Myles C. Maxfield <mmaxfi...@apple.com> Date: 2023-01-11 (Wed, 11 Jan 2023)
Changed paths: M Source/WTF/wtf/PlatformUse.h M Source/WebCore/platform/graphics/cocoa/FontCacheCoreText.cpp Log Message: ----------- [Cocoa] Use kCTFontVariationAxesAttribute where we can https://bugs.webkit.org/show_bug.cgi?id=250370 rdar://104066949 Reviewed by Cameron McCormack. For https://bugs.webkit.org/show_bug.cgi?id=247987, we want to create as few CTFonts, for performance. Our current font code converts between CTFonts and CTFontDescriptors fairly freely; however, all these conversions are somewhat wasteful. Instead, if we were using the Core Text API properly, we would simply go CFDictionary -> CTFontDescriptor -> CTFont once. Instead of going back and forth between all these types, we'd build in everything we need into a single dictionary/descriptor, and have one single place where we turn that descriptor into a font. This patch is one step along that journey, and removes one place where we have to create a font. Currently, we use CTFontCopyVariationAxes(), which requires a whole CTFont, which causes us to go CTFontDescriptor -> CTFont -> CTFontDescriptor. Instead, we can use kCTFontVariationAxesAttribute, which operates on a CTFontDescriptor, thereby using a FontDescriptor more often. There are more steps along this journey; this is just one step. No tests because there is no behavior change. * Source/WTF/wtf/PlatformUse.h: * Source/WebCore/platform/graphics/cocoa/FontCacheCoreText.cpp: (WebCore::variationAxes): (WebCore::variationCapabilitiesForFontDescriptor): Canonical link: https://commits.webkit.org/258809@main _______________________________________________ webkit-changes mailing list webkit-changes@lists.webkit.org https://lists.webkit.org/mailman/listinfo/webkit-changes