Branch: refs/heads/main
Home: https://github.com/WebKit/WebKit
Commit: 9719fea3eedbff1a91aff8edbda892bd67862e21
https://github.com/WebKit/WebKit/commit/9719fea3eedbff1a91aff8edbda892bd67862e21
Author: Brent Fulgham <[email protected]>
Date: 2026-10-13 (Tue, 13 Oct 2026)
Changed paths:
A
LayoutTests/imported/w3c/web-platform-tests/css/css-fonts/cluster-matching-canonical-equivalence-001-expected.html
A
LayoutTests/imported/w3c/web-platform-tests/css/css-fonts/cluster-matching-canonical-equivalence-001-ref.html
A
LayoutTests/imported/w3c/web-platform-tests/css/css-fonts/cluster-matching-canonical-equivalence-001.html
A
LayoutTests/imported/w3c/web-platform-tests/css/css-fonts/cluster-matching-canonical-equivalence-002-expected.html
A
LayoutTests/imported/w3c/web-platform-tests/css/css-fonts/cluster-matching-canonical-equivalence-002-ref.html
A
LayoutTests/imported/w3c/web-platform-tests/css/css-fonts/cluster-matching-canonical-equivalence-002.html
A
LayoutTests/imported/w3c/web-platform-tests/css/css-fonts/cluster-matching-canonical-equivalence-003-expected.html
A
LayoutTests/imported/w3c/web-platform-tests/css/css-fonts/cluster-matching-canonical-equivalence-003-ref.html
A
LayoutTests/imported/w3c/web-platform-tests/css/css-fonts/cluster-matching-canonical-equivalence-003.html
A
LayoutTests/imported/w3c/web-platform-tests/css/css-fonts/support/fonts/no-combining-marks.ttf
M Source/WTF/wtf/text/StringView.cpp
M Source/WTF/wtf/text/StringView.h
M Source/WebCore/platform/graphics/ComplexTextController.cpp
M Source/WebCore/platform/graphics/ComplexTextController.h
M Source/WebCore/platform/graphics/FontCascade.cpp
M Source/WebCore/platform/graphics/FontCascade.h
M Source/WebCore/platform/graphics/cairo/FontCairoHarfbuzzNG.cpp
M Source/WebCore/platform/graphics/coretext/ComplexTextControllerCoreText.mm
M Source/WebCore/platform/graphics/coretext/FontCascadeCoreText.cpp
M
Source/WebCore/platform/graphics/harfbuzz/ComplexTextControllerHarfBuzz.cpp
M Source/WebCore/platform/graphics/skia/ComplexTextControllerSkia.cpp
M Source/WebCore/platform/graphics/skia/FontCascadeSkia.cpp
M Source/WebCore/platform/graphics/win/ComplexTextControllerUniscribe.cpp
M Tools/TestWebKitAPI/Tests/WTF/StringView.cpp
Log Message:
-----------
Select fallback fonts and glyphs by canonical equivalence
https://bugs.webkit.org/show_bug.cgi?id=303066
rdar://165656837
Reviewed by Vitor Roriz.
FontCascade::fontForCombiningCharacterSequence on Cocoa and Skia accepts a
font for a combining character cluster only when the font's cmap has every
code point in the cluster. That is the first rule in step 1 of CSS Fonts 4
cluster matching. Neither port implemented the second, canonical-equivalence
rule, so a font missing only a combining mark's glyph was rejected even when
it had the precomposed letter, and the whole cluster fell back to a system
font with a different weight.
The canonical-equivalence check runs before moving on to the next font family,
so a cluster still comes from a single font, as intended by
https://bugs.webkit.org/show_bug.cgi?id=68287.
The new check keeps the cmap-based coverage test from
https://bugs.webkit.org/show_bug.cgi?id=185933, and uses the same test for
the precomposed character.
On Cocoa, choosing the font is not enough, because CoreText does not compose a
decomposed cluster into the precomposed glyph.
fontForCombiningCharacterSequence now reports the precomposed character it
matched, and ComplexTextController::collectComplexTextRuns builds the text to
shape from it while it walks the clusters, the same way it builds
m_smallCapsBuffer. ComplexTextRun maps the shaped indices back to the original
text. With synthesized small caps, a matched cluster is shaped from its
capitalized cluster's precomposed character when the font has one, and
otherwise is not shaped as small caps, because the font has none of the
cluster's combining marks.
On Skia, HarfBuzz already composes the cluster when it shapes, so the shaping
text is not needed. Font selection still reports the precomposed character it
matched, so the synthesized small caps decision above is the same as on Cocoa.
Tests:
imported/w3c/web-platform-tests/css/css-fonts/cluster-matching-canonical-equivalence-001.html
imported/w3c/web-platform-tests/css/css-fonts/cluster-matching-canonical-equivalence-002.html
imported/w3c/web-platform-tests/css/css-fonts/cluster-matching-canonical-equivalence-003.html
Tools/TestWebKitAPI/Tests/WTF/StringView.cpp
*
LayoutTests/imported/w3c/web-platform-tests/css/css-fonts/cluster-matching-canonical-equivalence-001-expected.html:
Added.
*
LayoutTests/imported/w3c/web-platform-tests/css/css-fonts/cluster-matching-canonical-equivalence-001-ref.html:
Added.
*
LayoutTests/imported/w3c/web-platform-tests/css/css-fonts/cluster-matching-canonical-equivalence-001.html:
Added.
*
LayoutTests/imported/w3c/web-platform-tests/css/css-fonts/cluster-matching-canonical-equivalence-002-expected.html:
Added.
*
LayoutTests/imported/w3c/web-platform-tests/css/css-fonts/cluster-matching-canonical-equivalence-002-ref.html:
Added.
*
LayoutTests/imported/w3c/web-platform-tests/css/css-fonts/cluster-matching-canonical-equivalence-002.html:
Added.
*
LayoutTests/imported/w3c/web-platform-tests/css/css-fonts/cluster-matching-canonical-equivalence-003-expected.html:
Added.
*
LayoutTests/imported/w3c/web-platform-tests/css/css-fonts/cluster-matching-canonical-equivalence-003-ref.html:
Added.
*
LayoutTests/imported/w3c/web-platform-tests/css/css-fonts/cluster-matching-canonical-equivalence-003.html:
Added.
*
LayoutTests/imported/w3c/web-platform-tests/css/css-fonts/support/fonts/no-combining-marks.ttf:
Added.
A subset of fonts/Lato-Medium.ttf with ASCII, U+01F0 and U+1E96 to U+1E99, and
no combining marks or layout features. It is renamed because Lato has a
Reserved Font Name.
* Source/WTF/wtf/text/StringView.cpp:
(WTF::StringView::precomposedCharacter const):
* Source/WTF/wtf/text/StringView.h:
* Source/WebCore/platform/graphics/ComplexTextController.cpp:
(WebCore::ComplexTextController::collectComplexTextRuns):
* Source/WebCore/platform/graphics/ComplexTextController.h:
(WebCore::ComplexTextController::ComplexTextRun::create):
* Source/WebCore/platform/graphics/FontCascade.cpp:
(WebCore::FontCascade::fontForCombiningCharacterSequence const):
* Source/WebCore/platform/graphics/FontCascade.h:
* Source/WebCore/platform/graphics/cairo/FontCairoHarfbuzzNG.cpp:
(WebCore::FontCascade::fontForCombiningCharacterSequence const):
* Source/WebCore/platform/graphics/coretext/ComplexTextControllerCoreText.mm:
(WebCore::ComplexTextController::ComplexTextRun::ComplexTextRun):
(WebCore::ComplexTextController::collectComplexTextRunsForCharacters):
* Source/WebCore/platform/graphics/coretext/FontCascadeCoreText.cpp:
(WebCore::fontForOrientation):
(WebCore::FontCascade::fontForCombiningCharacterSequence const):
* Source/WebCore/platform/graphics/harfbuzz/ComplexTextControllerHarfBuzz.cpp:
(WebCore::ComplexTextController::collectComplexTextRunsForCharacters):
* Source/WebCore/platform/graphics/skia/ComplexTextControllerSkia.cpp:
(WebCore::ComplexTextController::collectComplexTextRunsForCharacters):
* Source/WebCore/platform/graphics/skia/FontCascadeSkia.cpp:
(WebCore::FontCascade::fontForCombiningCharacterSequence const):
* Source/WebCore/platform/graphics/win/ComplexTextControllerUniscribe.cpp:
(WebCore::ComplexTextController::collectComplexTextRunsForCharacters):
* Tools/TestWebKitAPI/Tests/WTF/StringView.cpp:
(TestWebKitAPI::TEST(WTF, StringViewPrecomposedCharacter)):
(TestWebKitAPI::TEST(WTF, StringViewPrecomposedCharacterNone)):
Canonical link: https://commits.webkit.org/323560@main
To unsubscribe from these emails, change your notification settings at
https://github.com/WebKit/WebKit/settings/notifications