Log Message
REGRESSION(r281687): Space widths have synthetic bold applied to them in the fast text codepath but not the complex text codepath https://bugs.webkit.org/show_bug.cgi?id=235755 <rdar://problem/88052073>
Reviewed by Simon Fraser. LayoutTests/imported/w3c: * web-platform-tests/css/css-fonts/synthetic-bold-space-width-expected.html: Added. * web-platform-tests/css/css-fonts/synthetic-bold-space-width.html: Added. Source/WebCore: r281687 made Font::widthForGlyph() return the non-synthetically-expanded width, instead of the synthetically-expanded width. I think this is philosophically correct, because Font::widthForGlyph() is called before shaping, and shaping requires the original width. If some custom code is asking for the width of specific characters without going through WidthIterator or ComplexTextController, that code needs to determine whether or not it's going to run shaping, and thus when it should be adding in the synthetic offset. adjustGlyphsAndAdvances() used to subtract out the synthetic offset because it was expecting Font::widthForGlyph() to return the already-expanded width. So, the solution is just stop subtracting the offset, because it hasn't been applied in the first place. Test: imported/w3c/web-platform-tests/css/css-fonts/synthetic-bold-space-width.html * platform/graphics/ComplexTextController.cpp: (WebCore::ComplexTextController::adjustGlyphsAndAdvances): * platform/graphics/Font.h: LayoutTests: * platform/mac/fast/text/atsui-multiple-renderers-expected.txt:
Modified Paths
- trunk/LayoutTests/ChangeLog
- trunk/LayoutTests/imported/w3c/ChangeLog
- trunk/LayoutTests/platform/gtk/fast/css/font-face-synthetic-bold-italic-expected.txt
- trunk/LayoutTests/platform/mac/fast/text/atsui-multiple-renderers-expected.txt
- trunk/Source/WebCore/ChangeLog
- trunk/Source/WebCore/platform/graphics/ComplexTextController.cpp
- trunk/Source/WebCore/platform/graphics/Font.h
Added Paths
Diff
Modified: trunk/LayoutTests/ChangeLog (288782 => 288783)
--- trunk/LayoutTests/ChangeLog 2022-01-29 04:22:39 UTC (rev 288782)
+++ trunk/LayoutTests/ChangeLog 2022-01-29 04:44:04 UTC (rev 288783)
@@ -1,3 +1,13 @@
+2022-01-28 Myles C. Maxfield <[email protected]>
+
+ REGRESSION(r281687): Space widths have synthetic bold applied to them in the fast text codepath but not the complex text codepath
+ https://bugs.webkit.org/show_bug.cgi?id=235755
+ <rdar://problem/88052073>
+
+ Reviewed by Simon Fraser.
+
+ * platform/mac/fast/text/atsui-multiple-renderers-expected.txt:
+
2022-01-28 Nikolaos Mouchtaris <[email protected]>
Implement CSS overscroll-behavior for asynchronous scroll on Mac
Modified: trunk/LayoutTests/imported/w3c/ChangeLog (288782 => 288783)
--- trunk/LayoutTests/imported/w3c/ChangeLog 2022-01-29 04:22:39 UTC (rev 288782)
+++ trunk/LayoutTests/imported/w3c/ChangeLog 2022-01-29 04:44:04 UTC (rev 288783)
@@ -1,3 +1,14 @@
+2022-01-28 Myles C. Maxfield <[email protected]>
+
+ REGRESSION(r281687): Space widths have synthetic bold applied to them in the fast text codepath but not the complex text codepath
+ https://bugs.webkit.org/show_bug.cgi?id=235755
+ <rdar://problem/88052073>
+
+ Reviewed by Simon Fraser.
+
+ * web-platform-tests/css/css-fonts/synthetic-bold-space-width-expected.html: Added.
+ * web-platform-tests/css/css-fonts/synthetic-bold-space-width.html: Added.
+
2022-01-28 Antoine Quint <[email protected]>
[WPT] Remove outdated Web Animations expectations
Added: trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-fonts/synthetic-bold-space-width-expected.html (0 => 288783)
--- trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-fonts/synthetic-bold-space-width-expected.html (rev 0)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-fonts/synthetic-bold-space-width-expected.html 2022-01-29 04:44:04 UTC (rev 288783)
@@ -0,0 +1,12 @@
+<!DOCTYPE html>
+<html lang="en">
+<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
+<link rel="author" title="Myles C. Maxfield" href=""
+<style>
+pre {
+ font: bold 12px 'Monaco';
+}
+</style>
+<body>
+<p>This test passes if space characters' advances are expanded by the synthetic bold offset.</p>
+<pre style="font-feature-settings: 'ABCD';"><strong>hi asdf asdf asdf asdf asdf asdf asdf asdf asdf asdf asdf asdf asdf</strong></pre>
Added: trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-fonts/synthetic-bold-space-width.html (0 => 288783)
--- trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-fonts/synthetic-bold-space-width.html (rev 0)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-fonts/synthetic-bold-space-width.html 2022-01-29 04:44:04 UTC (rev 288783)
@@ -0,0 +1,13 @@
+<!DOCTYPE html>
+<html lang="en">
+<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
+<link rel="author" title="Myles C. Maxfield" href=""
+<link rel="match" href=""
+<style>
+pre {
+ font: bold 12px 'Monaco';
+}
+</style>
+<body>
+<p>This test passes if space characters' advances are expanded by the synthetic bold offset.</p>
+<pre><strong>hi asdf asdf asdf asdf asdf asdf asdf asdf asdf asdf asdf asdf asdf</strong></pre>
Modified: trunk/LayoutTests/platform/gtk/fast/css/font-face-synthetic-bold-italic-expected.txt (288782 => 288783)
--- trunk/LayoutTests/platform/gtk/fast/css/font-face-synthetic-bold-italic-expected.txt 2022-01-29 04:22:39 UTC (rev 288782)
+++ trunk/LayoutTests/platform/gtk/fast/css/font-face-synthetic-bold-italic-expected.txt 2022-01-29 04:44:04 UTC (rev 288783)
@@ -28,8 +28,8 @@
RenderInline {STRONG} at (0,0) size 0x0
RenderBlock (anonymous) at (0,152) size 784x16
RenderBlock {P} at (0,0) size 784x16
- RenderText {#text} at (0,0) size 321x16
- text run at (0,0) width 321: "Ahem synthetic bold"
+ RenderText {#text} at (0,0) size 323x16
+ text run at (0,0) width 323: "Ahem synthetic bold"
RenderBlock (anonymous) at (0,184) size 784x0
RenderInline {STRONG} at (0,0) size 0x0
RenderText {#text} at (0,0) size 0x0
@@ -53,8 +53,8 @@
RenderInline {I} at (0,0) size 0x0
RenderBlock (anonymous) at (0,284) size 784x16
RenderBlock {P} at (0,0) size 784x16
- RenderText {#text} at (0,0) size 439x16
- text run at (0,0) width 439: "Ahem synthetic bold italic"
+ RenderText {#text} at (0,0) size 442x16
+ text run at (0,0) width 442: "Ahem synthetic bold italic"
RenderBlock (anonymous) at (0,316) size 784x0
RenderInline {STRONG} at (0,0) size 0x0
RenderInline {I} at (0,0) size 0x0
Modified: trunk/LayoutTests/platform/mac/fast/text/atsui-multiple-renderers-expected.txt (288782 => 288783)
--- trunk/LayoutTests/platform/mac/fast/text/atsui-multiple-renderers-expected.txt 2022-01-29 04:22:39 UTC (rev 288782)
+++ trunk/LayoutTests/platform/mac/fast/text/atsui-multiple-renderers-expected.txt 2022-01-29 04:44:04 UTC (rev 288783)
@@ -16,10 +16,10 @@
RenderBlock {P} at (0,70) size 784x18
RenderText {#text} at (0,0) size 611x18
text run at (0,0) width 611: "The two columns should be identical except for the accent over the e and the umlaut over the u."
- RenderTable {TABLE} at (0,104) size 258x147 [border: none]
- RenderTableSection {TBODY} at (0,0) size 257x146
- RenderTableRow {TR} at (0,0) size 257x30
- RenderTableCell {TD} at (0,0) size 128x30 [border: (1px solid #008000)] [r=0 c=0 rs=1 cs=1]
+ RenderTable {TABLE} at (0,104) size 259x147 [border: none]
+ RenderTableSection {TBODY} at (0,0) size 258x146
+ RenderTableRow {TR} at (0,0) size 258x30
+ RenderTableCell {TD} at (0,0) size 129x30 [border: (1px solid #008000)] [r=0 c=0 rs=1 cs=1]
RenderText {#text} at (2,3) size 68x25
text run at (2,3) width 68: "Lore\x{300}m "
RenderInline {SPAN} at (0,0) size 50x23
@@ -26,7 +26,7 @@
RenderText {#text} at (69,5) size 50x23
text run at (69,5) width 50: "ipsu\x{308}m"
RenderText {#text} at (0,0) size 0x0
- RenderTableCell {TD} at (127,0) size 130x30 [border: (1px solid #008000)] [r=0 c=1 rs=1 cs=1]
+ RenderTableCell {TD} at (128,0) size 130x30 [border: (1px solid #008000)] [r=0 c=1 rs=1 cs=1]
RenderText {#text} at (2,3) size 68x25
text run at (2,3) width 68: "Lorem "
RenderInline {SPAN} at (0,0) size 50x23
@@ -33,15 +33,15 @@
RenderText {#text} at (69,5) size 50x23
text run at (69,5) width 50: "ipsum"
RenderText {#text} at (0,0) size 0x0
- RenderTableRow {TR} at (0,30) size 257x30
- RenderTableCell {TD} at (0,30) size 128x30 [border: (1px solid #008000)] [r=1 c=0 rs=1 cs=1]
- RenderText {#text} at (2,3) size 73x25
- text run at (2,3) width 73: "Lore\x{300}m "
+ RenderTableRow {TR} at (0,30) size 258x30
+ RenderTableCell {TD} at (0,30) size 129x30 [border: (1px solid #008000)] [r=1 c=0 rs=1 cs=1]
+ RenderText {#text} at (2,3) size 74x25
+ text run at (2,3) width 74: "Lore\x{300}m "
RenderInline {SPAN} at (0,0) size 53x23
- RenderText {#text} at (74,5) size 53x23
- text run at (74,5) width 53: "ipsu\x{308}m"
+ RenderText {#text} at (75,5) size 53x23
+ text run at (75,5) width 53: "ipsu\x{308}m"
RenderText {#text} at (0,0) size 0x0
- RenderTableCell {TD} at (127,30) size 130x30 [border: (1px solid #008000)] [r=1 c=1 rs=1 cs=1]
+ RenderTableCell {TD} at (128,30) size 130x30 [border: (1px solid #008000)] [r=1 c=1 rs=1 cs=1]
RenderText {#text} at (2,3) size 74x25
text run at (2,3) width 74: "Lorem "
RenderInline {SPAN} at (0,0) size 53x23
@@ -48,8 +48,8 @@
RenderText {#text} at (75,5) size 53x23
text run at (75,5) width 53: "ipsum"
RenderText {#text} at (0,0) size 0x0
- RenderTableRow {TR} at (0,60) size 257x30
- RenderTableCell {TD} at (0,60) size 128x30 [border: (1px solid #008000)] [r=2 c=0 rs=1 cs=1]
+ RenderTableRow {TR} at (0,60) size 258x30
+ RenderTableCell {TD} at (0,60) size 129x30 [border: (1px solid #008000)] [r=2 c=0 rs=1 cs=1]
RenderText {#text} at (2,3) size 68x25
text run at (2,3) width 68: "Lore\x{300}m "
RenderInline {SPAN} at (0,0) size 49x23
@@ -56,7 +56,7 @@
RenderText {#text} at (69,5) size 49x23
text run at (69,5) width 49: "ipsu\x{308}m"
RenderText {#text} at (0,0) size 0x0
- RenderTableCell {TD} at (127,60) size 130x30 [border: (1px solid #008000)] [r=2 c=1 rs=1 cs=1]
+ RenderTableCell {TD} at (128,60) size 130x30 [border: (1px solid #008000)] [r=2 c=1 rs=1 cs=1]
RenderText {#text} at (2,3) size 68x25
text run at (2,3) width 68: "Lorem "
RenderInline {SPAN} at (0,0) size 49x23
@@ -63,15 +63,15 @@
RenderText {#text} at (69,5) size 49x23
text run at (69,5) width 49: "ipsum"
RenderText {#text} at (0,0) size 0x0
- RenderTableRow {TR} at (0,90) size 257x30
- RenderTableCell {TD} at (0,90) size 128x30 [border: (1px solid #008000)] [r=3 c=0 rs=1 cs=1]
- RenderText {#text} at (2,3) size 73x25
- text run at (2,3) width 73: "Lore\x{300}m "
+ RenderTableRow {TR} at (0,90) size 258x30
+ RenderTableCell {TD} at (0,90) size 129x30 [border: (1px solid #008000)] [r=3 c=0 rs=1 cs=1]
+ RenderText {#text} at (2,3) size 74x25
+ text run at (2,3) width 74: "Lore\x{300}m "
RenderInline {SPAN} at (0,0) size 51x23
- RenderText {#text} at (74,5) size 51x23
- text run at (74,5) width 51: "ipsu\x{308}m"
+ RenderText {#text} at (75,5) size 51x23
+ text run at (75,5) width 51: "ipsu\x{308}m"
RenderText {#text} at (0,0) size 0x0
- RenderTableCell {TD} at (127,90) size 130x30 [border: (1px solid #008000)] [r=3 c=1 rs=1 cs=1]
+ RenderTableCell {TD} at (128,90) size 130x30 [border: (1px solid #008000)] [r=3 c=1 rs=1 cs=1]
RenderText {#text} at (2,3) size 74x25
text run at (2,3) width 74: "Lorem "
RenderInline {SPAN} at (0,0) size 51x23
@@ -78,11 +78,11 @@
RenderText {#text} at (75,5) size 51x23
text run at (75,5) width 51: "ipsum"
RenderText {#text} at (0,0) size 0x0
- RenderTableRow {TR} at (0,120) size 257x26
- RenderTableCell {TD} at (0,120) size 128x26 [border: (1px solid #008000)] [r=4 c=0 rs=1 cs=1]
+ RenderTableRow {TR} at (0,120) size 258x26
+ RenderTableCell {TD} at (0,120) size 129x26 [border: (1px solid #008000)] [r=4 c=0 rs=1 cs=1]
RenderText {#text} at (2,2) size 101x23
text run at (2,2) width 101: "Lore\x{300}m ipsu\x{308}m"
- RenderTableCell {TD} at (127,120) size 130x26 [border: (1px solid #008000)] [r=4 c=1 rs=1 cs=1]
+ RenderTableCell {TD} at (128,120) size 130x26 [border: (1px solid #008000)] [r=4 c=1 rs=1 cs=1]
RenderText {#text} at (2,2) size 101x23
text run at (2,2) width 101: "Lorem ipsum"
RenderBlock {HR} at (0,259) size 784x2 [border: (1px inset #000000)]
Modified: trunk/Source/WebCore/ChangeLog (288782 => 288783)
--- trunk/Source/WebCore/ChangeLog 2022-01-29 04:22:39 UTC (rev 288782)
+++ trunk/Source/WebCore/ChangeLog 2022-01-29 04:44:04 UTC (rev 288783)
@@ -1,3 +1,30 @@
+2022-01-28 Myles C. Maxfield <[email protected]>
+
+ REGRESSION(r281687): Space widths have synthetic bold applied to them in the fast text codepath but not the complex text codepath
+ https://bugs.webkit.org/show_bug.cgi?id=235755
+ <rdar://problem/88052073>
+
+ Reviewed by Simon Fraser.
+
+ r281687 made Font::widthForGlyph() return the non-synthetically-expanded width,
+ instead of the synthetically-expanded width.
+
+ I think this is philosophically correct, because Font::widthForGlyph() is called before shaping,
+ and shaping requires the original width. If some custom code is asking for the width of specific
+ characters without going through WidthIterator or ComplexTextController, that code needs to
+ determine whether or not it's going to run shaping, and thus when it should be adding in the
+ synthetic offset.
+
+ adjustGlyphsAndAdvances() used to subtract out the synthetic offset because it was expecting
+ Font::widthForGlyph() to return the already-expanded width. So, the solution is just stop subtracting
+ the offset, because it hasn't been applied in the first place.
+
+ Test: imported/w3c/web-platform-tests/css/css-fonts/synthetic-bold-space-width.html
+
+ * platform/graphics/ComplexTextController.cpp:
+ (WebCore::ComplexTextController::adjustGlyphsAndAdvances):
+ * platform/graphics/Font.h:
+
2022-01-28 Nikolaos Mouchtaris <[email protected]>
Implement CSS overscroll-behavior for asynchronous scroll on Mac
Modified: trunk/Source/WebCore/platform/graphics/ComplexTextController.cpp (288782 => 288783)
--- trunk/Source/WebCore/platform/graphics/ComplexTextController.cpp 2022-01-29 04:22:39 UTC (rev 288782)
+++ trunk/Source/WebCore/platform/graphics/ComplexTextController.cpp 2022-01-29 04:44:04 UTC (rev 288783)
@@ -693,7 +693,7 @@
const CGGlyph* glyphs = complexTextRun.glyphs();
const FloatSize* advances = complexTextRun.baseAdvances();
- float spaceWidth = font.spaceWidth() - font.syntheticBoldOffset();
+ float spaceWidth = font.spaceWidth();
const UChar* cp = complexTextRun.characters();
FloatPoint glyphOrigin;
unsigned lastCharacterIndex = m_run.ltr() ? std::numeric_limits<unsigned>::min() : std::numeric_limits<unsigned>::max();
Modified: trunk/Source/WebCore/platform/graphics/Font.h (288782 => 288783)
--- trunk/Source/WebCore/platform/graphics/Font.h 2022-01-29 04:22:39 UTC (rev 288782)
+++ trunk/Source/WebCore/platform/graphics/Font.h 2022-01-29 04:44:04 UTC (rev 288783)
@@ -137,12 +137,22 @@
void setAvgCharWidth(float avgCharWidth) { m_avgCharWidth = avgCharWidth; }
FloatRect boundsForGlyph(Glyph) const;
+
+ // If you're calling this, you need to care about synthetic bold.
+ // This function returns the width before adding in the synthetic bold offset.
+ // This is because these widths are fed as an input to shaping, which needs to consume the true widths.
+ // Then, the synthetic bold offset is applied after shaping.
+ // If you're not going through WidthIterator or ComplexTextController (and thus potentially executing shaping yourself),
+ // then you need to decide whether or not you need to add syntheticBoldOffset() to the result of your widthForGlyph() call.
float widthForGlyph(Glyph) const;
+
const Path& pathForGlyph(Glyph) const; // Don't store the result of this! The hash map is free to rehash at any point, leaving this reference dangling.
FloatRect platformBoundsForGlyph(Glyph) const;
float platformWidthForGlyph(Glyph) const;
Path platformPathForGlyph(Glyph) const;
+ // If you're calling this, you need to care about synthetic bold.
+ // See the comment just above widthForGlyph().
float spaceWidth() const { return m_spaceWidth; }
float syntheticBoldOffset() const { return m_syntheticBoldOffset; }
_______________________________________________ webkit-changes mailing list [email protected] https://lists.webkit.org/mailman/listinfo/webkit-changes
