[webkit-changes] [WebKit/WebKit] 8bbfbb: [Cocoa] font-variation-settings:opsz is not applie...

Myles C. Maxfield noreply at github.com
Tue Apr 11 11:20:48 PDT 2023


  Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 8bbfbb1f0689efdbb29611af60e552da8b16d993
      https://github.com/WebKit/WebKit/commit/8bbfbb1f0689efdbb29611af60e552da8b16d993
  Author: Myles C. Maxfield <mmaxfield at apple.com>
  Date:   2023-04-11 (Tue, 11 Apr 2023)

  Changed paths:
    A LayoutTests/fast/text/variations/optical-sizing-optimizeLegibility-expected-mismatch.html
    A LayoutTests/fast/text/variations/optical-sizing-optimizeLegibility.html
    M Source/WTF/wtf/PlatformUse.h
    M Source/WebCore/platform/graphics/FontTaggedSettings.h
    M Source/WebCore/platform/graphics/cocoa/UnrealizedCoreTextFont.cpp
    M Source/WebCore/platform/graphics/cocoa/UnrealizedCoreTextFont.h

  Log Message:
  -----------
  [Cocoa] font-variation-settings:opsz is not applied when text-rendering:optimizeLegibility is set
https://bugs.webkit.org/show_bug.cgi?id=254897
rdar://106814619

Reviewed by Simon Fraser.

text-rendering:optimizeLegibility turns on kCTFontOpticalSizeAttribute:”auto” in Core Text,
and font-variation-settings:opsz turns on kCTFontVariationAttribute:opsz in Core Text. When
both are applied, font-variation-settings is supposed to win. However, in Core Text,
kCTFontOpticalSizeAttribute wins.

The solution for this is to set kCTFontOpticalSizeAttribute to a specific size, given by
font-variation-settings:opsz. This should only happen when OpticalSizingTypes::Everything
is enabled, so this patch adds an optional<float> to that struct. All this is guarded by
a USE() so we can remove it if/when Core text changes to match the CSS behavior.

Test: fast/text/variations/optical-sizing-optimizeLegibility.html

* Source/WTF/wtf/PlatformUse.h:
* Source/WebCore/platform/graphics/FontTaggedSettings.h:
* Source/WebCore/platform/graphics/cocoa/UnrealizedCoreTextFont.cpp:
(WebCore::UnrealizedCoreTextFont::addAttributesForOpticalSizing):
(WebCore::UnrealizedCoreTextFont::modifyFromContext):
* Source/WebCore/platform/graphics/cocoa/UnrealizedCoreTextFont.h:

Canonical link: https://commits.webkit.org/262831@main




More information about the webkit-changes mailing list