Title: [281687] trunk
Revision
281687
Author
[email protected]
Date
2021-08-26 23:18:56 -0700 (Thu, 26 Aug 2021)

Log Message

Synthetic bold additional advances need to be applied after shaping
https://bugs.webkit.org/show_bug.cgi?id=189448
<rdar://problem/40994395>

Reviewed by Alan Bujtas.

Source/WebCore:

We implement synthetic bold by drawing every glyph twice, the second time 1px to the right of the
first time. This effectively means that the advance of such glyphs needs to be increased by 1px.
Previously, we were doing this before shaping, which is a problem for some fonts which clobber the
input advances during shaping, and emit totally new advances. Osaka is one such font. In order to
make sure that these fonts have their synthetic bold advances correctly increased, we need to do
the increasing after text shaping, rather than before it.

This patch temporarily disables LFC when synthetic bold is in effect. I will teach LFC how to handle
synthetic bold in a follow-up patch.

Test: fast/text/osaka-synthetic-bold.html

* layout/integration/LayoutIntegrationCoverage.cpp:
(WebCore::LayoutIntegration::canUseForText):
* platform/graphics/Font.h:
(WebCore::Font::syntheticBoldOffset const):
(WebCore::Font::widthForGlyph const):
* platform/graphics/WidthIterator.cpp:
(WebCore::WidthIterator::adjustForSyntheticBold):
(WebCore::WidthIterator::applyCSSVisibilityRules):
* platform/graphics/WidthIterator.h:
* platform/graphics/coretext/FontCoreText.cpp:
(WebCore::Font::platformWidthForGlyph const):
(WebCore::Font::platformBoundsForGlyph const):

LayoutTests:

These tests are progressions.

* fast/text/osaka-synthetic-bold-expected.txt: Added.
* fast/text/osaka-synthetic-bold.html: Added.
* platform/ios/imported/w3c/web-platform-tests/mathml/relations/css-styling/ignored-properties-001-expected.txt:
* platform/mac-catalina/imported/w3c/web-platform-tests/mathml/relations/css-styling/ignored-properties-001-expected.txt:
* platform/mac-mojave/imported/w3c/web-platform-tests/mathml/relations/css-styling/ignored-properties-001-expected.txt:
* platform/mac/fast/text/atsui-multiple-renderers-expected.png: Added.
* platform/mac/fast/text/atsui-multiple-renderers-expected.txt:
* platform/mac/fonts/cursive-expected.png: Added.
* platform/mac/fonts/cursive-expected.txt:
* platform/mac/imported/w3c/web-platform-tests/mathml/relations/css-styling/ignored-properties-001-expected.txt:
* platform/mac/TestExpectations:
* platform/win/fast/text-indicator/text-indicator-estimated-color-with-implicit-newline-expected.txt: Added.
* platform/win/svg/W3C-SVG-1.1-SE/svgdom-over-01-f-expected.txt:

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (281686 => 281687)


--- trunk/LayoutTests/ChangeLog	2021-08-27 05:42:41 UTC (rev 281686)
+++ trunk/LayoutTests/ChangeLog	2021-08-27 06:18:56 UTC (rev 281687)
@@ -1,3 +1,27 @@
+2021-08-26  Myles C. Maxfield  <[email protected]>
+
+        Synthetic bold additional advances need to be applied after shaping
+        https://bugs.webkit.org/show_bug.cgi?id=189448
+        <rdar://problem/40994395>
+
+        Reviewed by Alan Bujtas.
+
+        These tests are progressions.
+
+        * fast/text/osaka-synthetic-bold-expected.txt: Added.
+        * fast/text/osaka-synthetic-bold.html: Added.
+        * platform/ios/imported/w3c/web-platform-tests/mathml/relations/css-styling/ignored-properties-001-expected.txt:
+        * platform/mac-catalina/imported/w3c/web-platform-tests/mathml/relations/css-styling/ignored-properties-001-expected.txt:
+        * platform/mac-mojave/imported/w3c/web-platform-tests/mathml/relations/css-styling/ignored-properties-001-expected.txt:
+        * platform/mac/fast/text/atsui-multiple-renderers-expected.png: Added.
+        * platform/mac/fast/text/atsui-multiple-renderers-expected.txt:
+        * platform/mac/fonts/cursive-expected.png: Added.
+        * platform/mac/fonts/cursive-expected.txt:
+        * platform/mac/imported/w3c/web-platform-tests/mathml/relations/css-styling/ignored-properties-001-expected.txt:
+        * platform/mac/TestExpectations:
+        * platform/win/fast/text-indicator/text-indicator-estimated-color-with-implicit-newline-expected.txt: Added.
+        * platform/win/svg/W3C-SVG-1.1-SE/svgdom-over-01-f-expected.txt:
+
 2021-08-26  Joone Hur  <[email protected]>
 
         Caret should respect text background color

Added: trunk/LayoutTests/fast/text/osaka-synthetic-bold-expected.txt (0 => 281687)


--- trunk/LayoutTests/fast/text/osaka-synthetic-bold-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/fast/text/osaka-synthetic-bold-expected.txt	2021-08-27 06:18:56 UTC (rev 281687)
@@ -0,0 +1,37 @@
+This test makes sure that Osaka's synthetic bold doesn't cause bogus character widths.
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+PASS internals.absoluteCaretBounds().left is <= comparison.getBoundingClientRect().width + 2
+PASS internals.absoluteCaretBounds().left is <= comparison.getBoundingClientRect().width + 2
+PASS internals.absoluteCaretBounds().left is <= comparison.getBoundingClientRect().width + 2
+PASS internals.absoluteCaretBounds().left is <= comparison.getBoundingClientRect().width + 2
+PASS internals.absoluteCaretBounds().left is <= comparison.getBoundingClientRect().width + 2
+PASS internals.absoluteCaretBounds().left is <= comparison.getBoundingClientRect().width + 2
+PASS internals.absoluteCaretBounds().left is <= comparison.getBoundingClientRect().width + 2
+PASS internals.absoluteCaretBounds().left is <= comparison.getBoundingClientRect().width + 2
+PASS internals.absoluteCaretBounds().left is <= comparison.getBoundingClientRect().width + 2
+PASS internals.absoluteCaretBounds().left is <= comparison.getBoundingClientRect().width + 2
+PASS internals.absoluteCaretBounds().left is <= comparison.getBoundingClientRect().width + 2
+PASS internals.absoluteCaretBounds().left is <= comparison.getBoundingClientRect().width + 2
+PASS internals.absoluteCaretBounds().left is <= comparison.getBoundingClientRect().width + 2
+PASS internals.absoluteCaretBounds().left is <= comparison.getBoundingClientRect().width + 2
+PASS internals.absoluteCaretBounds().left is <= comparison.getBoundingClientRect().width + 2
+PASS internals.absoluteCaretBounds().left is <= comparison.getBoundingClientRect().width + 2
+PASS internals.absoluteCaretBounds().left is <= comparison.getBoundingClientRect().width + 2
+PASS internals.absoluteCaretBounds().left is <= comparison.getBoundingClientRect().width + 2
+PASS internals.absoluteCaretBounds().left is <= comparison.getBoundingClientRect().width + 2
+PASS internals.absoluteCaretBounds().left is <= comparison.getBoundingClientRect().width + 2
+PASS internals.absoluteCaretBounds().left is <= comparison.getBoundingClientRect().width + 2
+PASS internals.absoluteCaretBounds().left is <= comparison.getBoundingClientRect().width + 2
+PASS internals.absoluteCaretBounds().left is <= comparison.getBoundingClientRect().width + 2
+PASS internals.absoluteCaretBounds().left is <= comparison.getBoundingClientRect().width + 2
+PASS internals.absoluteCaretBounds().left is <= comparison.getBoundingClientRect().width + 2
+PASS internals.absoluteCaretBounds().left is <= comparison.getBoundingClientRect().width + 2
+PASS internals.absoluteCaretBounds().left is <= comparison.getBoundingClientRect().width + 2
+PASS internals.absoluteCaretBounds().left is <= comparison.getBoundingClientRect().width + 2
+PASS successfullyParsed is true
+
+TEST COMPLETE
+20202020202020202020202020202020202020202020202020202020

Added: trunk/LayoutTests/fast/text/osaka-synthetic-bold.html (0 => 281687)


--- trunk/LayoutTests/fast/text/osaka-synthetic-bold.html	                        (rev 0)
+++ trunk/LayoutTests/fast/text/osaka-synthetic-bold.html	2021-08-27 06:18:56 UTC (rev 281687)
@@ -0,0 +1,22 @@
+<!DOCTYPE html>
+<html>
+<head>
+<meta charset="utf-8">
+<script src=""
+</head>
+<body>
+<div id="target" style="font: bold 16px 'Osaka'; position: absolute; left: 0px; top: 200px; width: 100%;" contenteditable>2020202020202020202020202020</div>
+<span id="comparison" style="font: bold 16px 'Osaka';">2020202020202020202020202020</div>
+<script>
+description("This test makes sure that Osaka's synthetic bold doesn't cause bogus character widths.");
+let target = document.getElementById("target");
+let comparison = document.getElementById("comparison");
+target.focus();
+for (var i = 0; i < 28; ++i) {
+    window.getSelection().modify('move', 'forward', 'character');
+    if (window.internals)
+        shouldBeLessThanOrEqual("internals.absoluteCaretBounds().left", "comparison.getBoundingClientRect().width + 2");
+}
+</script>
+</body>
+</html>

Modified: trunk/LayoutTests/platform/ios/imported/w3c/web-platform-tests/mathml/relations/css-styling/ignored-properties-001-expected.txt (281686 => 281687)


--- trunk/LayoutTests/platform/ios/imported/w3c/web-platform-tests/mathml/relations/css-styling/ignored-properties-001-expected.txt	2021-08-27 05:42:41 UTC (rev 281686)
+++ trunk/LayoutTests/platform/ios/imported/w3c/web-platform-tests/mathml/relations/css-styling/ignored-properties-001-expected.txt	2021-08-27 06:18:56 UTC (rev 281687)
@@ -24,7 +24,7 @@
 PASS menclose preferred width calculation is not affected by width: 100px !important; height: 200px !important;
 PASS menclose layout is not affected by width: 100px !important; height: 200px !important;
 PASS merror preferred width calculation is not affected by writing-mode: vertical-rl;
-FAIL merror layout is not affected by writing-mode: vertical-rl; assert_approx_equals: inline position (child 1) expected 9.03125 +/- 1 but got 0
+FAIL merror layout is not affected by writing-mode: vertical-rl; assert_approx_equals: inline position (child 1) expected 8.03125 +/- 1 but got 0
 PASS merror preferred width calculation is not affected by white-space: normal;
 PASS merror layout is not affected by white-space: normal;
 PASS merror preferred width calculation is not affected by float: right;

Modified: trunk/LayoutTests/platform/mac/TestExpectations (281686 => 281687)


--- trunk/LayoutTests/platform/mac/TestExpectations	2021-08-27 05:42:41 UTC (rev 281686)
+++ trunk/LayoutTests/platform/mac/TestExpectations	2021-08-27 06:18:56 UTC (rev 281687)
@@ -2387,5 +2387,6 @@
 
 webkit.org/b/228176 [ Mojave Catalina BigSur Monterey ] fast/text/variable-system-font-2.html [ Pass ]
 
-# This test opens apparently unskippable prompts on Catalina.
+# These tests open apparently unskippable prompts on Catalina.
 webkit.org/b/229391 [ Mojave Catalina ] fast/text/mobileasset-font.html [ Skip ]
+webkit.org/b/189448 [ Mojave Catalina ] fast/text/osaka-synthetic-bold.html [ Skip ]

Added: trunk/LayoutTests/platform/mac/fast/text/atsui-multiple-renderers-expected.png


(Binary files differ)
Index: trunk/LayoutTests/platform/mac/fast/text/atsui-multiple-renderers-expected.png =================================================================== --- trunk/LayoutTests/platform/mac/fast/text/atsui-multiple-renderers-expected.png 2021-08-27 05:42:41 UTC (rev 281686) +++ trunk/LayoutTests/platform/mac/fast/text/atsui-multiple-renderers-expected.png 2021-08-27 06:18:56 UTC (rev 281687) Property changes on: trunk/LayoutTests/platform/mac/fast/text/atsui-multiple-renderers-expected.png ___________________________________________________________________

Added: svn:mime-type

+image/png \ No newline at end of property

Modified: trunk/LayoutTests/platform/mac/fast/text/atsui-multiple-renderers-expected.txt (281686 => 281687)


--- trunk/LayoutTests/platform/mac/fast/text/atsui-multiple-renderers-expected.txt	2021-08-27 05:42:41 UTC (rev 281686)
+++ trunk/LayoutTests/platform/mac/fast/text/atsui-multiple-renderers-expected.txt	2021-08-27 06:18:56 UTC (rev 281687)
@@ -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 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]
+      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]
               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 (128,0) size 130x30 [border: (1px solid #008000)] [r=0 c=1 rs=1 cs=1]
+            RenderTableCell {TD} at (127,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 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 "
+          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 "
               RenderInline {SPAN} at (0,0) size 53x23
-                RenderText {#text} at (75,5) size 53x23
-                  text run at (75,5) width 53: "ipsu\x{308}m"
+                RenderText {#text} at (74,5) size 53x23
+                  text run at (74,5) width 53: "ipsu\x{308}m"
               RenderText {#text} at (0,0) size 0x0
-            RenderTableCell {TD} at (128,30) size 130x30 [border: (1px solid #008000)] [r=1 c=1 rs=1 cs=1]
+            RenderTableCell {TD} at (127,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 258x30
-            RenderTableCell {TD} at (0,60) size 129x30 [border: (1px solid #008000)] [r=2 c=0 rs=1 cs=1]
+          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]
               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 (128,60) size 130x30 [border: (1px solid #008000)] [r=2 c=1 rs=1 cs=1]
+            RenderTableCell {TD} at (127,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 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 "
+          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 "
               RenderInline {SPAN} at (0,0) size 51x23
-                RenderText {#text} at (75,5) size 51x23
-                  text run at (75,5) width 51: "ipsu\x{308}m"
+                RenderText {#text} at (74,5) size 51x23
+                  text run at (74,5) width 51: "ipsu\x{308}m"
               RenderText {#text} at (0,0) size 0x0
-            RenderTableCell {TD} at (128,90) size 130x30 [border: (1px solid #008000)] [r=3 c=1 rs=1 cs=1]
+            RenderTableCell {TD} at (127,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 258x26
-            RenderTableCell {TD} at (0,120) size 129x26 [border: (1px solid #008000)] [r=4 c=0 rs=1 cs=1]
+          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]
               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 (128,120) size 130x26 [border: (1px solid #008000)] [r=4 c=1 rs=1 cs=1]
+            RenderTableCell {TD} at (127,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)]

Added: trunk/LayoutTests/platform/mac/fonts/cursive-expected.png


(Binary files differ)
Index: trunk/LayoutTests/platform/mac/fonts/cursive-expected.png =================================================================== --- trunk/LayoutTests/platform/mac/fonts/cursive-expected.png 2021-08-27 05:42:41 UTC (rev 281686) +++ trunk/LayoutTests/platform/mac/fonts/cursive-expected.png 2021-08-27 06:18:56 UTC (rev 281687) Property changes on: trunk/LayoutTests/platform/mac/fonts/cursive-expected.png ___________________________________________________________________

Added: svn:mime-type

+image/png \ No newline at end of property

Modified: trunk/LayoutTests/platform/mac/fonts/cursive-expected.txt (281686 => 281687)


--- trunk/LayoutTests/platform/mac/fonts/cursive-expected.txt	2021-08-27 05:42:41 UTC (rev 281686)
+++ trunk/LayoutTests/platform/mac/fonts/cursive-expected.txt	2021-08-27 06:18:56 UTC (rev 281687)
@@ -303,9 +303,9 @@
             RenderText {#text} at (0,25) size 21x25
               text run at (0,25) width 21: "!!!!"
             RenderBR {BR} at (20,25) size 1x25
-            RenderText {#text} at (0,50) size 25x25
-              text run at (0,50) width 25: "\"\"\"\""
-            RenderBR {BR} at (24,50) size 1x25
+            RenderText {#text} at (0,50) size 29x25
+              text run at (0,50) width 29: "\"\"\"\""
+            RenderBR {BR} at (28,50) size 1x25
             RenderText {#text} at (0,75) size 40x25
               text run at (0,75) width 40: "####"
             RenderBR {BR} at (39,75) size 1x25
@@ -318,9 +318,9 @@
             RenderText {#text} at (0,150) size 61x25
               text run at (0,150) width 61: "&&&&"
             RenderBR {BR} at (60,150) size 1x25
-            RenderText {#text} at (0,175) size 14x25
-              text run at (0,175) width 14: "''''"
-            RenderBR {BR} at (13,175) size 1x25
+            RenderText {#text} at (0,175) size 18x25
+              text run at (0,175) width 18: "''''"
+            RenderBR {BR} at (17,175) size 1x25
             RenderText {#text} at (0,200) size 26x25
               text run at (0,200) width 26: "(((("
             RenderBR {BR} at (25,200) size 1x25
@@ -507,12 +507,12 @@
             RenderText {#text} at (0,1725) size 28x25
               text run at (0,1725) width 28: "eeee"
             RenderBR {BR} at (27,1725) size 1x25
-            RenderText {#text} at (0,1750) size 20x25
-              text run at (0,1750) width 20: "ffff"
-            RenderBR {BR} at (19,1750) size 1x25
-            RenderText {#text} at (0,1775) size 30x25
-              text run at (0,1775) width 30: "gggg"
-            RenderBR {BR} at (29,1775) size 1x25
+            RenderText {#text} at (0,1750) size 22x25
+              text run at (0,1750) width 22: "ffff"
+            RenderBR {BR} at (21,1750) size 1x25
+            RenderText {#text} at (0,1775) size 32x25
+              text run at (0,1775) width 32: "gggg"
+            RenderBR {BR} at (31,1775) size 1x25
             RenderText {#text} at (0,1800) size 39x25
               text run at (0,1800) width 39: "hhhh"
             RenderBR {BR} at (38,1800) size 1x25
@@ -525,9 +525,9 @@
             RenderText {#text} at (0,1875) size 34x25
               text run at (0,1875) width 34: "kkkk"
             RenderBR {BR} at (33,1875) size 1x25
-            RenderText {#text} at (0,1900) size 18x25
-              text run at (0,1900) width 18: "llll"
-            RenderBR {BR} at (17,1900) size 1x25
+            RenderText {#text} at (0,1900) size 20x25
+              text run at (0,1900) width 20: "llll"
+            RenderBR {BR} at (19,1900) size 1x25
             RenderText {#text} at (0,1925) size 55x25
               text run at (0,1925) width 55: "mmmm"
             RenderBR {BR} at (54,1925) size 1x25
@@ -549,9 +549,9 @@
             RenderText {#text} at (0,2075) size 27x25
               text run at (0,2075) width 27: "ssss"
             RenderBR {BR} at (26,2075) size 1x25
-            RenderText {#text} at (0,2100) size 21x25
-              text run at (0,2100) width 21: "tttt"
-            RenderBR {BR} at (20,2100) size 1x25
+            RenderText {#text} at (0,2100) size 23x25
+              text run at (0,2100) width 23: "tttt"
+            RenderBR {BR} at (22,2100) size 1x25
             RenderText {#text} at (0,2125) size 40x25
               text run at (0,2125) width 40: "uuuu"
             RenderBR {BR} at (39,2125) size 1x25

Modified: trunk/LayoutTests/platform/mac/imported/w3c/web-platform-tests/mathml/relations/css-styling/ignored-properties-001-expected.txt (281686 => 281687)


--- trunk/LayoutTests/platform/mac/imported/w3c/web-platform-tests/mathml/relations/css-styling/ignored-properties-001-expected.txt	2021-08-27 05:42:41 UTC (rev 281686)
+++ trunk/LayoutTests/platform/mac/imported/w3c/web-platform-tests/mathml/relations/css-styling/ignored-properties-001-expected.txt	2021-08-27 06:18:56 UTC (rev 281687)
@@ -24,7 +24,7 @@
 PASS menclose preferred width calculation is not affected by width: 100px !important; height: 200px !important;
 PASS menclose layout is not affected by width: 100px !important; height: 200px !important;
 PASS merror preferred width calculation is not affected by writing-mode: vertical-rl;
-FAIL merror layout is not affected by writing-mode: vertical-rl; assert_approx_equals: inline position (child 1) expected 9.03125 +/- 1 but got 0
+FAIL merror layout is not affected by writing-mode: vertical-rl; assert_approx_equals: inline position (child 1) expected 8.03125 +/- 1 but got 0
 PASS merror preferred width calculation is not affected by white-space: normal;
 PASS merror layout is not affected by white-space: normal;
 PASS merror preferred width calculation is not affected by float: right;

Modified: trunk/LayoutTests/platform/mac-catalina/imported/w3c/web-platform-tests/mathml/relations/css-styling/ignored-properties-001-expected.txt (281686 => 281687)


--- trunk/LayoutTests/platform/mac-catalina/imported/w3c/web-platform-tests/mathml/relations/css-styling/ignored-properties-001-expected.txt	2021-08-27 05:42:41 UTC (rev 281686)
+++ trunk/LayoutTests/platform/mac-catalina/imported/w3c/web-platform-tests/mathml/relations/css-styling/ignored-properties-001-expected.txt	2021-08-27 06:18:56 UTC (rev 281687)
@@ -24,7 +24,7 @@
 PASS menclose preferred width calculation is not affected by width: 100px !important; height: 200px !important;
 PASS menclose layout is not affected by width: 100px !important; height: 200px !important;
 PASS merror preferred width calculation is not affected by writing-mode: vertical-rl;
-FAIL merror layout is not affected by writing-mode: vertical-rl; assert_approx_equals: inline position (child 1) expected 9.03125 +/- 1 but got 0
+FAIL merror layout is not affected by writing-mode: vertical-rl; assert_approx_equals: inline position (child 1) expected 8.03125 +/- 1 but got 0
 PASS merror preferred width calculation is not affected by white-space: normal;
 PASS merror layout is not affected by white-space: normal;
 PASS merror preferred width calculation is not affected by float: right;

Modified: trunk/LayoutTests/platform/mac-mojave/imported/w3c/web-platform-tests/mathml/relations/css-styling/ignored-properties-001-expected.txt (281686 => 281687)


--- trunk/LayoutTests/platform/mac-mojave/imported/w3c/web-platform-tests/mathml/relations/css-styling/ignored-properties-001-expected.txt	2021-08-27 05:42:41 UTC (rev 281686)
+++ trunk/LayoutTests/platform/mac-mojave/imported/w3c/web-platform-tests/mathml/relations/css-styling/ignored-properties-001-expected.txt	2021-08-27 06:18:56 UTC (rev 281687)
@@ -24,7 +24,7 @@
 PASS menclose preferred width calculation is not affected by width: 100px !important; height: 200px !important;
 PASS menclose layout is not affected by width: 100px !important; height: 200px !important;
 PASS merror preferred width calculation is not affected by writing-mode: vertical-rl;
-FAIL merror layout is not affected by writing-mode: vertical-rl; assert_approx_equals: inline position (child 1) expected 9.03125 +/- 1 but got 0
+FAIL merror layout is not affected by writing-mode: vertical-rl; assert_approx_equals: inline position (child 1) expected 8.03125 +/- 1 but got 0
 PASS merror preferred width calculation is not affected by white-space: normal;
 PASS merror layout is not affected by white-space: normal;
 PASS merror preferred width calculation is not affected by float: right;

Added: trunk/LayoutTests/platform/win/fast/text-indicator/text-indicator-estimated-color-with-implicit-newline-expected.txt (0 => 281687)


--- trunk/LayoutTests/platform/win/fast/text-indicator/text-indicator-estimated-color-with-implicit-newline-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/platform/win/fast/text-indicator/text-indicator-estimated-color-with-implicit-newline-expected.txt	2021-08-27 06:18:56 UTC (rev 281687)
@@ -0,0 +1,3 @@
+indicator:
+    0 0 88 22
+

Modified: trunk/LayoutTests/platform/win/svg/W3C-SVG-1.1-SE/svgdom-over-01-f-expected.txt (281686 => 281687)


--- trunk/LayoutTests/platform/win/svg/W3C-SVG-1.1-SE/svgdom-over-01-f-expected.txt	2021-08-27 05:42:41 UTC (rev 281686)
+++ trunk/LayoutTests/platform/win/svg/W3C-SVG-1.1-SE/svgdom-over-01-f-expected.txt	2021-08-27 06:18:56 UTC (rev 281687)
@@ -140,6 +140,6 @@
     RenderSVGRect {rect} at (0,0) size 480x360 [stroke={[type=SOLID] [color=#000000]}] [x=1.00] [y=1.00] [width=478.00] [height=358.00]
     RenderSVGContainer {g} at (0,0) size 480x23
       RenderSVGRect {rect} at (0,0) size 480x22 [stroke={[type=SOLID] [color=#000000]}] [fill={[type=SOLID] [color=#FF0000]}] [x=1.00] [y=1.00] [width=478.00] [height=20.00]
-      RenderSVGText {text} at (205,2) size 70x20 contains 1 chunk(s)
-        RenderSVGInlineText {#text} at (0,0) size 70x20
-          chunk 1 (middle anchor) text run 1 at (205.00,18.00) startOffset 0 endOffset 5 width 70.00: "DRAFT"
+      RenderSVGText {text} at (202,2) size 76x20 contains 1 chunk(s)
+        RenderSVGInlineText {#text} at (0,0) size 75x20
+          chunk 1 (middle anchor) text run 1 at (202.50,18.00) startOffset 0 endOffset 5 width 75.00: "DRAFT"

Modified: trunk/Source/WebCore/ChangeLog (281686 => 281687)


--- trunk/Source/WebCore/ChangeLog	2021-08-27 05:42:41 UTC (rev 281686)
+++ trunk/Source/WebCore/ChangeLog	2021-08-27 06:18:56 UTC (rev 281687)
@@ -1,3 +1,36 @@
+2021-08-26  Myles C. Maxfield  <[email protected]>
+
+        Synthetic bold additional advances need to be applied after shaping
+        https://bugs.webkit.org/show_bug.cgi?id=189448
+        <rdar://problem/40994395>
+
+        Reviewed by Alan Bujtas.
+
+        We implement synthetic bold by drawing every glyph twice, the second time 1px to the right of the
+        first time. This effectively means that the advance of such glyphs needs to be increased by 1px.
+        Previously, we were doing this before shaping, which is a problem for some fonts which clobber the
+        input advances during shaping, and emit totally new advances. Osaka is one such font. In order to
+        make sure that these fonts have their synthetic bold advances correctly increased, we need to do
+        the increasing after text shaping, rather than before it.
+
+        This patch temporarily disables LFC when synthetic bold is in effect. I will teach LFC how to handle
+        synthetic bold in a follow-up patch.
+
+        Test: fast/text/osaka-synthetic-bold.html
+
+        * layout/integration/LayoutIntegrationCoverage.cpp:
+        (WebCore::LayoutIntegration::canUseForText):
+        * platform/graphics/Font.h:
+        (WebCore::Font::syntheticBoldOffset const):
+        (WebCore::Font::widthForGlyph const):
+        * platform/graphics/WidthIterator.cpp:
+        (WebCore::WidthIterator::adjustForSyntheticBold):
+        (WebCore::WidthIterator::applyCSSVisibilityRules):
+        * platform/graphics/WidthIterator.h:
+        * platform/graphics/coretext/FontCoreText.cpp:
+        (WebCore::Font::platformWidthForGlyph const):
+        (WebCore::Font::platformBoundsForGlyph const):
+
 2021-08-26  Joone Hur  <[email protected]>
 
         Caret should respect text background color

Modified: trunk/Source/WebCore/layout/integration/LayoutIntegrationCoverage.cpp (281686 => 281687)


--- trunk/Source/WebCore/layout/integration/LayoutIntegrationCoverage.cpp	2021-08-27 05:42:41 UTC (rev 281686)
+++ trunk/Source/WebCore/layout/integration/LayoutIntegrationCoverage.cpp	2021-08-27 06:18:56 UTC (rev 281687)
@@ -435,6 +435,10 @@
     OptionSet<AvoidanceReason> reasons;
     auto& primaryFont = fontCascade.primaryFont();
 
+    // FIXME: Teach FontCascade::widthForSimpleText() how to deal with synthetic bold, so we can use LFC.
+    if (primaryFont.syntheticBoldOffset())
+        SET_REASON_AND_RETURN_IF_NEEDED(FlowPrimaryFontIsInsufficient, reasons, includeReasons);
+
     for (unsigned i = 0; i < length; ++i) {
         auto character = text[i];
         auto characterReasons = canUseForCharacter(character, includeReasons);

Modified: trunk/Source/WebCore/platform/graphics/Font.h (281686 => 281687)


--- trunk/Source/WebCore/platform/graphics/Font.h	2021-08-27 05:42:41 UTC (rev 281686)
+++ trunk/Source/WebCore/platform/graphics/Font.h	2021-08-27 06:18:56 UTC (rev 281687)
@@ -160,9 +160,7 @@
         m_adjustedSpaceWidth = spaceWidth;
     }
 
-#if USE(CG) || USE(DIRECT2D) || USE(CAIRO)
     float syntheticBoldOffset() const { return m_syntheticBoldOffset; }
-#endif
 
     Glyph spaceGlyph() const { return m_spaceGlyph; }
     void setSpaceGlyph(Glyph spaceGlyph) { m_spaceGlyph = spaceGlyph; }
@@ -338,9 +336,7 @@
     float m_spaceWidth { 0 };
     float m_adjustedSpaceWidth { 0 };
 
-#if USE(CG) || USE(DIRECT2D) || USE(CAIRO)
     float m_syntheticBoldOffset { 0 };
-#endif
 
     unsigned m_treatAsFixedPitch : 1;
     unsigned m_isInterstitial : 1; // Whether or not this custom font is the last resort placeholder for a loading font
@@ -397,14 +393,10 @@
         return width;
 
 #if ENABLE(OPENTYPE_VERTICAL)
-    if (m_verticalData) {
-#if USE(CG) || USE(DIRECT2D) || USE(CAIRO)
-        width = m_verticalData->advanceHeight(this, glyph) + m_syntheticBoldOffset;
-#else
+    if (m_verticalData)
         width = m_verticalData->advanceHeight(this, glyph);
+    else
 #endif
-    } else
-#endif
         width = platformWidthForGlyph(glyph);
 
     m_glyphToWidthMap.setMetricsForGlyph(glyph, width);

Modified: trunk/Source/WebCore/platform/graphics/WidthIterator.cpp (281686 => 281687)


--- trunk/Source/WebCore/platform/graphics/WidthIterator.cpp	2021-08-27 05:42:41 UTC (rev 281686)
+++ trunk/Source/WebCore/platform/graphics/WidthIterator.cpp	2021-08-27 06:18:56 UTC (rev 281687)
@@ -556,6 +556,16 @@
     return true;
 }
 
+void WidthIterator::adjustForSyntheticBold(GlyphBuffer& glyphBuffer, unsigned index)
+{
+    auto glyph = glyphBuffer.glyphAt(index);
+    static constexpr const GlyphBufferGlyph deletedGlyph = 0xFFFF;
+    auto syntheticBoldOffset = glyph == deletedGlyph ? 0 : glyphBuffer.fontAt(index).syntheticBoldOffset();
+    m_runWidthSoFar += syntheticBoldOffset;
+    auto& advance = glyphBuffer.advances(index)[0];
+    setWidth(advance, width(advance) + syntheticBoldOffset);
+}
+
 void WidthIterator::applyCSSVisibilityRules(GlyphBuffer& glyphBuffer, unsigned glyphBufferStartIndex)
 {
     // This function needs to be kept in sync with characterCanUseSimplifiedTextMeasuring().
@@ -577,6 +587,7 @@
             ASSERT(glyphBuffer.fonts(i)[0]);
             // FIXME: Is this actually necessary? If the font specifically has a glyph for NBSP, I don't see a reason not to use it.
             glyphBuffer.glyphs(i)[0] = glyphBuffer.fonts(i)[0]->spaceGlyph();
+            adjustForSyntheticBold(glyphBuffer, i);
             continue;
         }
 
@@ -594,6 +605,8 @@
             continue;
         }
 
+        adjustForSyntheticBold(glyphBuffer, i);
+
         if ((characterResponsibleForThisGlyph >= nullCharacter && characterResponsibleForThisGlyph < space)
             || (characterResponsibleForThisGlyph >= deleteCharacter && characterResponsibleForThisGlyph < noBreakSpace)) {
             m_runWidthSoFar -= width(glyphBuffer.advanceAt(i));
@@ -623,8 +636,6 @@
             continue;
         }
     }
-
-    
 }
 
 void WidthIterator::finalize(GlyphBuffer& buffer)

Modified: trunk/Source/WebCore/platform/graphics/WidthIterator.h (281686 => 281687)


--- trunk/Source/WebCore/platform/graphics/WidthIterator.h	2021-08-27 05:42:41 UTC (rev 281686)
+++ trunk/Source/WebCore/platform/graphics/WidthIterator.h	2021-08-27 06:18:56 UTC (rev 281687)
@@ -76,6 +76,7 @@
     bool hasExtraSpacing() const;
     void applyExtraSpacingAfterShaping(GlyphBuffer&, unsigned characterStartIndex, unsigned glyphBufferStartIndex, unsigned characterDestinationIndex, float startingRunWidth);
     void applyCSSVisibilityRules(GlyphBuffer&, unsigned glyphBufferStartIndex);
+    void adjustForSyntheticBold(GlyphBuffer&, unsigned index);
 
     struct AdditionalWidth {
         float left;

Modified: trunk/Source/WebCore/platform/graphics/coretext/FontCoreText.cpp (281686 => 281687)


--- trunk/Source/WebCore/platform/graphics/coretext/FontCoreText.cpp	2021-08-27 05:42:41 UTC (rev 281686)
+++ trunk/Source/WebCore/platform/graphics/coretext/FontCoreText.cpp	2021-08-27 06:18:56 UTC (rev 281687)
@@ -579,7 +579,7 @@
             CTFontGetAdvancesForGlyphs(m_platformData.ctFont(), orientation, &glyph, &advance, 1);
         }
     }
-    return advance.width + m_syntheticBoldOffset;
+    return advance.width;
 }
 
 #endif
@@ -711,8 +711,7 @@
     CGRect ignoredRect = { };
     boundingBox = CTFontGetBoundingRectsForGlyphs(m_platformData.ctFont(), platformData().orientation() == FontOrientation::Vertical ? kCTFontOrientationVertical : kCTFontOrientationHorizontal, &glyph, &ignoredRect, 1);
     boundingBox.setY(-boundingBox.maxY());
-    if (m_syntheticBoldOffset)
-        boundingBox.setWidth(boundingBox.width() + m_syntheticBoldOffset);
+    boundingBox.setWidth(boundingBox.width() + m_syntheticBoldOffset);
 
     return boundingBox;
 }
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to