[webkit-changes] [WebKit/WebKit] 03b288: Add support for font-variant-caps in WidthIterator...
Vitor Roriz
noreply at github.com
Mon Aug 21 10:50:51 PDT 2023
Branch: refs/heads/main
Home: https://github.com/WebKit/WebKit
Commit: 03b288845585ac6ed3440b092b97bd543da6a5be
https://github.com/WebKit/WebKit/commit/03b288845585ac6ed3440b092b97bd543da6a5be
Author: Vitor Roriz <vitor.roriz at apple.com>
Date: 2023-08-21 (Mon, 21 Aug 2023)
Changed paths:
M LayoutTests/imported/w3c/web-platform-tests/svg/import/fonts-desc-02-t-manual.svg
M LayoutTests/platform/glib/imported/w3c/web-platform-tests/svg/import/text-dom-02-f-manual-expected.txt
M LayoutTests/platform/glib/imported/w3c/web-platform-tests/svg/import/text-dom-05-f-manual-expected.txt
M LayoutTests/platform/glib/imported/w3c/web-platform-tests/svg/import/text-tselect-02-f-manual-expected.txt
M LayoutTests/platform/gtk/fast/text/drawBidiText-expected.png
A LayoutTests/platform/gtk/imported/w3c/web-platform-tests/svg/import/text-dom-02-f-manual-expected.png
A LayoutTests/platform/gtk/imported/w3c/web-platform-tests/svg/import/text-dom-02-f-manual-expected.txt
A LayoutTests/platform/gtk/imported/w3c/web-platform-tests/svg/import/text-dom-05-f-manual-expected.png
A LayoutTests/platform/gtk/imported/w3c/web-platform-tests/svg/import/text-dom-05-f-manual-expected.txt
A LayoutTests/platform/gtk/imported/w3c/web-platform-tests/svg/import/text-tselect-02-f-manual-expected.png
A LayoutTests/platform/gtk/imported/w3c/web-platform-tests/svg/import/text-tselect-02-f-manual-expected.txt
M LayoutTests/platform/ios-simulator/imported/w3c/web-platform-tests/svg/import/fonts-desc-02-t-manual-expected.png
M LayoutTests/platform/ios-simulator/imported/w3c/web-platform-tests/svg/import/fonts-desc-02-t-manual-expected.txt
M LayoutTests/platform/ios-simulator/imported/w3c/web-platform-tests/svg/import/fonts-desc-05-t-manual-expected.png
M LayoutTests/platform/ios-simulator/imported/w3c/web-platform-tests/svg/import/fonts-desc-05-t-manual-expected.txt
M LayoutTests/platform/ios-simulator/imported/w3c/web-platform-tests/svg/import/text-fonts-203-t-manual-expected.txt
M LayoutTests/platform/ios-simulator/imported/w3c/web-platform-tests/svg/import/text-fonts-204-t-manual-expected.txt
M LayoutTests/platform/ios/svg/W3C-SVG-1.1/fonts-desc-02-t-expected.txt
M LayoutTests/platform/mac/imported/w3c/web-platform-tests/svg/import/fonts-desc-02-t-manual-expected.png
M LayoutTests/platform/mac/imported/w3c/web-platform-tests/svg/import/fonts-desc-02-t-manual-expected.txt
M LayoutTests/platform/mac/imported/w3c/web-platform-tests/svg/import/fonts-desc-05-t-manual-expected.png
M LayoutTests/platform/mac/imported/w3c/web-platform-tests/svg/import/fonts-desc-05-t-manual-expected.txt
M LayoutTests/platform/mac/imported/w3c/web-platform-tests/svg/import/text-fonts-203-t-manual-expected.txt
M LayoutTests/platform/mac/imported/w3c/web-platform-tests/svg/import/text-fonts-204-t-manual-expected.txt
A LayoutTests/platform/wpe/imported/w3c/web-platform-tests/svg/import/text-dom-02-f-manual-expected.png
A LayoutTests/platform/wpe/imported/w3c/web-platform-tests/svg/import/text-dom-02-f-manual-expected.txt
A LayoutTests/platform/wpe/imported/w3c/web-platform-tests/svg/import/text-dom-05-f-manual-expected.png
A LayoutTests/platform/wpe/imported/w3c/web-platform-tests/svg/import/text-dom-05-f-manual-expected.txt
A LayoutTests/platform/wpe/imported/w3c/web-platform-tests/svg/import/text-tselect-02-f-manual-expected.png
A LayoutTests/platform/wpe/imported/w3c/web-platform-tests/svg/import/text-tselect-02-f-manual-expected.txt
M Source/WebCore/platform/graphics/ComplexTextController.cpp
M Source/WebCore/platform/graphics/ComposedCharacterClusterTextIterator.h
M Source/WebCore/platform/graphics/Font.h
M Source/WebCore/platform/graphics/FontCascade.cpp
M Source/WebCore/platform/graphics/FontCascade.h
M Source/WebCore/platform/graphics/Latin1TextIterator.h
M Source/WebCore/platform/graphics/SurrogatePairAwareTextIterator.h
M Source/WebCore/platform/graphics/WidthIterator.cpp
M Source/WebCore/platform/graphics/WidthIterator.h
Log Message:
-----------
Add support for font-variant-caps in WidthIterator (simple path)
https://bugs.webkit.org/show_bug.cgi?id=259736
rdar://110431790
Reviewed by Myles C. Maxfield.
Right now, font-variant small-caps can just be handled if we take
the Complex path in text layout, which is implemented by ComplexTextController.
Implementing small-caps handling in WidthIterator allows WebKit to
layout text taking the Simple path and use the WidthIterator when
font-feature or font-variants are used, including font-variant-caps.
The logic introduced for small-caps tries to mimic the one
in ComplexTextController. There, everytime there is change
in Font or in the small-caps state, a new run is created
with the determined font, which can be synthesized or not.
If any character in the run needs to be synthesized, all characters
are synthesized.
Here, for the WidthIterator, we don't split our runs in new runs for
each variation. Instead, we define a range and commit it. Each range
is represented by a font, that can be synthesized or not, like in
ComplexTextController, and a range glyph buffer. The buffer contains
the glyphs to the characters that compose the range. They are
add to the final glyph buffer each time we commit a range.
We are reusing the logic for determinig if a character should be synthesized
or not. Therefore, "shouldSynthesize()" and "capitalized()" functions
are moved from ComplexTextController to FontCascade.
When we are processing a range and we detect that the current font
can't be used for represent a glyph and it needs to be synthesized,
we need to synthesize the whole range. Therefore, we reset the iterator
to the index of the last font transition we have registered. For that,
we are adding the capability for the Latin1TextIterator and the
SurrogatePairAwareTextIterator to reset the current index to a given
index.
* LayoutTests/platform/gtk/fast/text/drawBidiText-expected.png:
* LayoutTests/platform/gtk/fast/text/drawBidiText-expected.txt:
* LayoutTests/platform/gtk/imported/w3c/web-platform-tests/svg/import/text-dom-02-f-manual-expected.png: Added.
* LayoutTests/platform/gtk/imported/w3c/web-platform-tests/svg/import/text-dom-02-f-manual-expected.txt: Added.
* LayoutTests/platform/gtk/imported/w3c/web-platform-tests/svg/import/text-dom-05-f-manual-expected.png: Added.
* LayoutTests/platform/gtk/imported/w3c/web-platform-tests/svg/import/text-dom-05-f-manual-expected.txt: Added.
* LayoutTests/platform/gtk/imported/w3c/web-platform-tests/svg/import/text-tselect-02-f-manual-expected.png: Added.
* LayoutTests/platform/gtk/imported/w3c/web-platform-tests/svg/import/text-tselect-02-f-manual-expected.txt: Added.
* LayoutTests/platform/wpe/imported/w3c/web-platform-tests/svg/import/text-dom-02-f-manual-expected.png: Added.
* LayoutTests/platform/wpe/imported/w3c/web-platform-tests/svg/import/text-dom-02-f-manual-expected.txt: Added.
* LayoutTests/platform/wpe/imported/w3c/web-platform-tests/svg/import/text-dom-05-f-manual-expected.png: Added.
* LayoutTests/platform/wpe/imported/w3c/web-platform-tests/svg/import/text-dom-05-f-manual-expected.txt: Added.
* LayoutTests/platform/wpe/imported/w3c/web-platform-tests/svg/import/text-tselect-02-f-manual-expected.png: Added.
* LayoutTests/platform/wpe/imported/w3c/web-platform-tests/svg/import/text-tselect-02-f-manual-expected.txt: Added.
* LayoutTests/imported/w3c/web-platform-tests/svg/import/fonts-desc-02-t-manual.svg:
* LayoutTests/platform/glib/imported/w3c/web-platform-tests/svg/import/text-dom-02-f-manual-expected.txt:
* LayoutTests/platform/glib/imported/w3c/web-platform-tests/svg/import/text-dom-05-f-manual-expected.txt:
* LayoutTests/platform/glib/imported/w3c/web-platform-tests/svg/import/text-tselect-02-f-manual-expected.txt:
* LayoutTests/platform/ios-simulator/imported/w3c/web-platform-tests/svg/import/fonts-desc-02-t-manual-expected.png:
* LayoutTests/platform/ios-simulator/imported/w3c/web-platform-tests/svg/import/fonts-desc-02-t-manual-expected.txt:
* LayoutTests/platform/ios-simulator/imported/w3c/web-platform-tests/svg/import/fonts-desc-05-t-manual-expected.png:
* LayoutTests/platform/ios-simulator/imported/w3c/web-platform-tests/svg/import/fonts-desc-05-t-manual-expected.txt:
* LayoutTests/platform/ios-simulator/imported/w3c/web-platform-tests/svg/import/text-fonts-203-t-manual-expected.txt:
* LayoutTests/platform/ios-simulator/imported/w3c/web-platform-tests/svg/import/text-fonts-204-t-manual-expected.txt:
* LayoutTests/platform/ios/svg/W3C-SVG-1.1/fonts-desc-02-t-expected.txt:
* LayoutTests/platform/mac/imported/w3c/web-platform-tests/svg/import/fonts-desc-02-t-manual-expected.png:
* LayoutTests/platform/mac/imported/w3c/web-platform-tests/svg/import/fonts-desc-02-t-manual-expected.txt:
* LayoutTests/platform/mac/imported/w3c/web-platform-tests/svg/import/fonts-desc-05-t-manual-expected.png:
* LayoutTests/platform/mac/imported/w3c/web-platform-tests/svg/import/fonts-desc-05-t-manual-expected.txt:
* LayoutTests/platform/mac/imported/w3c/web-platform-tests/svg/import/text-fonts-203-t-manual-expected.txt:
* LayoutTests/platform/mac/imported/w3c/web-platform-tests/svg/import/text-fonts-204-t-manual-expected.txt:
* Source/WebCore/platform/graphics/ComplexTextController.cpp:
(WebCore::ComplexTextController::collectComplexTextRuns):
(WebCore::capitalized): Deleted.
(WebCore::shouldSynthesize): Deleted.
* Source/WebCore/platform/graphics/ComposedCharacterClusterTextIterator.h:
(WebCore::ComposedCharacterClusterTextIterator::reset):
* Source/WebCore/platform/graphics/Font.h:
(WebCore::Font::variantFont const):
* Source/WebCore/platform/graphics/FontCascade.cpp:
(WebCore::FontCascade::codePath const):
(WebCore::shouldSynthesizeSmallCaps):
(WebCore::capitalized):
* Source/WebCore/platform/graphics/FontCascade.h:
* Source/WebCore/platform/graphics/Latin1TextIterator.h:
(WebCore::Latin1TextIterator::Latin1TextIterator):
(WebCore::Latin1TextIterator::consume):
(WebCore::Latin1TextIterator::advance):
(WebCore::Latin1TextIterator::reset):
* Source/WebCore/platform/graphics/SurrogatePairAwareTextIterator.h:
(WebCore::SurrogatePairAwareTextIterator::SurrogatePairAwareTextIterator):
(WebCore::SurrogatePairAwareTextIterator::consume):
(WebCore::SurrogatePairAwareTextIterator::advance):
(WebCore::SurrogatePairAwareTextIterator::reset):
* Source/WebCore/platform/graphics/WidthIterator.cpp:
(WebCore::WidthIterator::hasExtraSpacing const):
(WebCore::resetGlyphBuffer):
(WebCore::SmallCapsState::SmallCapsState):
(WebCore::SmallCapsState::setSmallCapsData):
(WebCore::SmallCapsState::clear):
(WebCore::SmallCapsState::setIsSmallCaps):
(WebCore::SmallCapsState::skipSmallCapsProcessing const):
(WebCore::AdvanceInternalState::AdvanceInternalState):
(WebCore::AdvanceInternalState::fontChanged const):
(WebCore::AdvanceInternalState::updateFont):
(WebCore::WidthIterator::commitCurrentFontRange):
(WebCore::fontForRange):
(WebCore::WidthIterator::startNewFontRangeIfNeeded):
(WebCore::resetFontRangeIfNeeded):
(WebCore::updateCharacterAndSmallCapsIfNeeded):
(WebCore::WidthIterator::advanceInternal):
* Source/WebCore/platform/graphics/WidthIterator.h:
Canonical link: https://commits.webkit.org/267095@main
More information about the webkit-changes
mailing list