Branch: refs/heads/main Home: https://github.com/WebKit/WebKit Commit: e9e9b4699c26d5e69ffeafd259edcc7e203479fb https://github.com/WebKit/WebKit/commit/e9e9b4699c26d5e69ffeafd259edcc7e203479fb Author: Myles C. Maxfield <mmaxfi...@apple.com> Date: 2023-07-12 (Wed, 12 Jul 2023)
Changed paths: A LayoutTests/fast/text/variations/optical-sizing-out-of-bounds-expected.html A LayoutTests/fast/text/variations/optical-sizing-out-of-bounds.html M Source/WTF/wtf/PlatformUse.h M Source/WebCore/platform/graphics/cocoa/FontCacheCoreText.h M Source/WebCore/platform/graphics/cocoa/UnrealizedCoreTextFont.cpp M Source/WebCore/platform/graphics/cocoa/UnrealizedCoreTextFont.h Log Message: ----------- [Cocoa] [Downlevels] Out of bounds optical sizing is rendered as the default value instead of clamping https://bugs.webkit.org/show_bug.cgi?id=258764 rdar://111535841 Reviewed by Cameron McCormack. On pre-2023-aligned Apple OSes, Core Text's behavior for optical sizing is that out of bounds values are ignored, and default optical sizing is used instead of clamping the specified value. We can work around this by clamping the value ourself in WebKit, but this is somewhat unfortunate because we only know the acceptable range after creating a CTFont, but we'd like to specify the values during CTFont creation time. This patch solves the problem by doing a 2-phase creation: Create a CTFont, inspect it, determine if it needs a second phase, and if it does, modify the CTFont to create a second, derived, CTFont. We already have some support for this due to the TrueType GX weight/width/slope scales being different than the CSS scales - but we don't know if a font is a TrueType GX font until we've created the CTFont object. This patch extends that existing 2-phase creation to also recreate the font if the optical sizing ended up wrong. * LayoutTests/fast/text/variations/optical-sizing-out-of-bounds-expected.html: Added. * LayoutTests/fast/text/variations/optical-sizing-out-of-bounds.html: Added. * Source/WTF/wtf/PlatformUse.h: * Source/WebCore/platform/graphics/cocoa/UnrealizedCoreTextFont.cpp: (WebCore::OpticalSizeRange::isInRange const): (WebCore::opticalSizeRange): (WebCore::UnrealizedCoreTextFont::rebuildReason const): (WebCore::UnrealizedCoreTextFont::realize const): * Source/WebCore/platform/graphics/cocoa/UnrealizedCoreTextFont.h: (WebCore::UnrealizedCoreTextFont::RebuildReason::hasEffect const): Canonical link: https://commits.webkit.org/266000@main _______________________________________________ webkit-changes mailing list webkit-changes@lists.webkit.org https://lists.webkit.org/mailman/listinfo/webkit-changes