-
Notifications
You must be signed in to change notification settings - Fork 1.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. Weβll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Cocoa] font-optical-sizing:auto doesn't set the opsz variation axis for all fonts that need it #10354
Conversation
EWS run on previous version of this PR (hash 9922549) |
All these tests pass on a new Mac operating system, so I think we need a version check. |
91751c1
to
9619f04
Compare
EWS run on previous version of this PR (hash 9619f04) |
9619f04
to
34cbb7d
Compare
EWS run on previous version of this PR (hash 34cbb7d)
|
34cbb7d
to
8c3872d
Compare
EWS run on previous version of this PR (hash 8c3872d)
|
@@ -391,3 +391,10 @@ | |||
// The header says "Before macOS 13.0 and iOS 16.0 this attribute is not accurate" | |||
#define USE_KCTFONTVARIATIONAXESATTRIBUTE 1 | |||
#endif | |||
|
|||
#if (PLATFORM(MAC) && __MAC_OS_X_VERSION_MAX_ALLOWED >= 130000) \ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Update copyright
Verified tests pass on Ventura |
This patch should be disabled on Monterey. |
8c3872d
to
e0eb411
Compare
EWS run on previous version of this PR (hash e0eb411)
|
e0eb411
to
47febba
Compare
EWS run on current version of this PR (hash 47febba)
|
β¦for all fonts that need it https://bugs.webkit.org/show_bug.cgi?id=252552 rdar://105662167 Reviewed by Alan Baradlay. This is a follow-up from 260447@main. That previous patch went almost all the way toward fixing the problem, but couldn't actually apply optical sizing to all text that requested it. The reason for this is that the trigger we were using to enable optical sizing, `kCTFontOpticalSizeAttribute`, enables the `opsz` variation axis, but also enables the `trak` table. Unfortunately, we have a lot of tests which use fonts that don't support the optical sizing variation axis, but do have a `trak` table. So, if we just naively started enabling `kCTFontOpticalSizeAttribute` for all text that requests it, we'll get tons of test failures. It's not really great if we make tons of text on the web look different, without it being a deliberate decision. So, the previous patch stopped just short of enabling `kCTFontOpticalSizeAttribute` everywhere. However, all fonts which *do* support the `opsz` variation axis should have it set automatically, which is what 260447@main was aiming to address. We have the ability to *just* set the variation axis without also setting `trak`, so that's what we need to do for fonts that request optical sizing but for which we can't use `kCTFontOpticalSizeAttribute` because of compatibility. So, we need 3 buckets: - Disable optical sizing. This is triggered by font-optical-sizing:none. This maps to telling Core Text to use `kCTFontOpticalSizeAttribute`: `none`. - Enable full optical sizing, including `trak`. This is triggered by text-rendering:optimizeLegibility. This maps to telling Core Text to use `kCTFontOpticalSizeAttribute`: `auto`. - Enable optical sizing, but just the `opsz` variation, and not `trak`, for compatibility. This is what all situations not captured by the above use. This maps to telling Core Text to use `kCTFontVariationAttribute`: {`opsz`: font size}. This patch implements the third bucket, which wasn't implemented in the previous patch. The third bucket doesn't actually work correctly on older OSes, so it's guarded behind a OS version check. https://bugs.webkit.org/show_bug.cgi?id=252592 is about deleting the compatibility third bucket in favor of the second bucket: actually enabling `trak` for all text that should have optical sizing enabled. Just like 260447@main, the tests for this adds a megabyte of fonts (because we have to keep the whole release of an OFL font together) so I'm not including the test with this PR, and will upload another PR later with a custom font that I create from scratch for testing this. * Source/WTF/wtf/PlatformUse.h: * Source/WebCore/platform/graphics/cocoa/UnrealizedCoreTextFont.cpp: (WebCore::UnrealizedCoreTextFont::addAttributesForOpticalSizing): (WebCore::UnrealizedCoreTextFont::applyVariations): (WebCore::UnrealizedCoreTextFont::modifyFromContext): (WebCore::UnrealizedCoreTextFont::realize const): (WebCore::applyVariations): Deleted. (WebCore::modifyFromContext): Deleted. * Source/WebCore/platform/graphics/cocoa/UnrealizedCoreTextFont.h: Canonical link: https://commits.webkit.org/260781@main
47febba
to
b2e8181
Compare
Committed 260781@main (b2e8181): https://commits.webkit.org/260781@main Reviewed commits have been landed. Closing PR #10354 and removing active labels. |
b2e8181
47febba
π§ͺ api-iosπ§ͺ jsc-armv7-testsπ watch