Title: [245230] branches/safari-608.1.24-branch
Revision
245230
Author
[email protected]
Date
2019-05-12 23:51:20 -0700 (Sun, 12 May 2019)

Log Message

Cherry-pick r245191. rdar://problem/48027412

    [iOS] baidu.com: Synthetic bold renders too far apart, appears doubled.
    https://bugs.webkit.org/show_bug.cgi?id=197781
    <rdar://problem/48027412>

    Reviewed by Simon Fraser.

    Source/WebCore:

    Synthetic bold is essentially two regular glyphs painted with an offset. While on macOS this offset is always 1px (CSS), on iOS larger font produces higher offset value. At paint time, this offset value (in CSS px unit) get converted
    to a device pixel value taking context scale into account. This conversion ensures that the gap between the 2 regular glyphs won't get wider (in device pixels) as the user pinch zooms in.
    This works as long as the scale on the context is >= 1. This patch ensures that a scaled down context won't blow up this gap.

    Test: fast/text/large-synthetic-bold-with-scale-transform.html

    * platform/graphics/cocoa/FontCascadeCocoa.mm:
    (WebCore::FontCascade::drawGlyphs):

    LayoutTests:

    * fast/text/large-synthetic-bold-with-scale-transform-expected.html: Added.
    * fast/text/large-synthetic-bold-with-scale-transform.html: Added.

    git-svn-id: https://svn.webkit.org/repository/webkit/trunk@245191 268f45cc-cd09-0410-ab3c-d52691b4dbfc

Modified Paths

Added Paths

Diff

Modified: branches/safari-608.1.24-branch/LayoutTests/ChangeLog (245229 => 245230)


--- branches/safari-608.1.24-branch/LayoutTests/ChangeLog	2019-05-13 06:51:16 UTC (rev 245229)
+++ branches/safari-608.1.24-branch/LayoutTests/ChangeLog	2019-05-13 06:51:20 UTC (rev 245230)
@@ -1,5 +1,45 @@
 2019-05-12  Babak Shafiei  <[email protected]>
 
+        Cherry-pick r245191. rdar://problem/48027412
+
+    [iOS] baidu.com: Synthetic bold renders too far apart, appears doubled.
+    https://bugs.webkit.org/show_bug.cgi?id=197781
+    <rdar://problem/48027412>
+    
+    Reviewed by Simon Fraser.
+    
+    Source/WebCore:
+    
+    Synthetic bold is essentially two regular glyphs painted with an offset. While on macOS this offset is always 1px (CSS), on iOS larger font produces higher offset value. At paint time, this offset value (in CSS px unit) get converted
+    to a device pixel value taking context scale into account. This conversion ensures that the gap between the 2 regular glyphs won't get wider (in device pixels) as the user pinch zooms in.
+    This works as long as the scale on the context is >= 1. This patch ensures that a scaled down context won't blow up this gap.
+    
+    Test: fast/text/large-synthetic-bold-with-scale-transform.html
+    
+    * platform/graphics/cocoa/FontCascadeCocoa.mm:
+    (WebCore::FontCascade::drawGlyphs):
+    
+    LayoutTests:
+    
+    * fast/text/large-synthetic-bold-with-scale-transform-expected.html: Added.
+    * fast/text/large-synthetic-bold-with-scale-transform.html: Added.
+    
+    
+    git-svn-id: https://svn.webkit.org/repository/webkit/trunk@245191 268f45cc-cd09-0410-ab3c-d52691b4dbfc
+
+    2019-05-10  Zalan Bujtas  <[email protected]>
+
+            [iOS] baidu.com: Synthetic bold renders too far apart, appears doubled.
+            https://bugs.webkit.org/show_bug.cgi?id=197781
+            <rdar://problem/48027412>
+
+            Reviewed by Simon Fraser.
+
+            * fast/text/large-synthetic-bold-with-scale-transform-expected.html: Added.
+            * fast/text/large-synthetic-bold-with-scale-transform.html: Added.
+
+2019-05-12  Babak Shafiei  <[email protected]>
+
         Cherry-pick r245144. rdar://problem/47902054
 
     [iOS] Unable to commit search on MSN.com, qq.com, or sina.com.cn using enter key (hardware or software keyboard)

Added: branches/safari-608.1.24-branch/LayoutTests/fast/text/large-synthetic-bold-with-scale-transform-expected.html ( => )


Added: branches/safari-608.1.24-branch/LayoutTests/fast/text/large-synthetic-bold-with-scale-transform.html
===================================================================
--- branches/safari-608.1.24-branch/LayoutTests/fast/text/large-synthetic-bold-with-scale-transform.html	                        (rev 0)
+++ branches/safari-608.1.24-branch/LayoutTests/fast/text/large-synthetic-bold-with-scale-transform.html	2019-05-13 06:51:20 UTC (rev 245230)
@@ -0,0 +1,40 @@
+<!DOCTYPE html>
+<html>
+<head>
+<title>This tests that we don't end up painting large gaps for synthetic bold when tall text gets scaled down.</title>
+<style>
+	body {
+		font-family: 'Hiragino Maru Gothic ProN';
+		font-weight: bold;
+		font-size: 900px;
+		margin: 0px;
+	}
+
+	div {
+		transform: scale(0.01);
+		height: 20px;
+		width: 20px;
+	}
+
+	.cover {
+		transform: none;
+		background-color: white;
+		position: absolute;
+		top: 0px;
+		left: 0px;
+		height: 150px;
+		width: 20px;
+	}
+</style>
+</head>
+<body>
+<div>F</div>
+<div>o</div>
+<div>o</div>
+<div>B</div>
+<div>a</div>
+<div>r</div>
+<div class=cover></div>
+</div>
+</body>
+</html>

Modified: branches/safari-608.1.24-branch/Source/WebCore/ChangeLog (245229 => 245230)


--- branches/safari-608.1.24-branch/Source/WebCore/ChangeLog	2019-05-13 06:51:16 UTC (rev 245229)
+++ branches/safari-608.1.24-branch/Source/WebCore/ChangeLog	2019-05-13 06:51:20 UTC (rev 245230)
@@ -1,3 +1,49 @@
+2019-05-12  Babak Shafiei  <[email protected]>
+
+        Cherry-pick r245191. rdar://problem/48027412
+
+    [iOS] baidu.com: Synthetic bold renders too far apart, appears doubled.
+    https://bugs.webkit.org/show_bug.cgi?id=197781
+    <rdar://problem/48027412>
+    
+    Reviewed by Simon Fraser.
+    
+    Source/WebCore:
+    
+    Synthetic bold is essentially two regular glyphs painted with an offset. While on macOS this offset is always 1px (CSS), on iOS larger font produces higher offset value. At paint time, this offset value (in CSS px unit) get converted
+    to a device pixel value taking context scale into account. This conversion ensures that the gap between the 2 regular glyphs won't get wider (in device pixels) as the user pinch zooms in.
+    This works as long as the scale on the context is >= 1. This patch ensures that a scaled down context won't blow up this gap.
+    
+    Test: fast/text/large-synthetic-bold-with-scale-transform.html
+    
+    * platform/graphics/cocoa/FontCascadeCocoa.mm:
+    (WebCore::FontCascade::drawGlyphs):
+    
+    LayoutTests:
+    
+    * fast/text/large-synthetic-bold-with-scale-transform-expected.html: Added.
+    * fast/text/large-synthetic-bold-with-scale-transform.html: Added.
+    
+    
+    git-svn-id: https://svn.webkit.org/repository/webkit/trunk@245191 268f45cc-cd09-0410-ab3c-d52691b4dbfc
+
+    2019-05-10  Zalan Bujtas  <[email protected]>
+
+            [iOS] baidu.com: Synthetic bold renders too far apart, appears doubled.
+            https://bugs.webkit.org/show_bug.cgi?id=197781
+            <rdar://problem/48027412>
+
+            Reviewed by Simon Fraser.
+
+            Synthetic bold is essentially two regular glyphs painted with an offset. While on macOS this offset is always 1px (CSS), on iOS larger font produces higher offset value. At paint time, this offset value (in CSS px unit) get converted
+            to a device pixel value taking context scale into account. This conversion ensures that the gap between the 2 regular glyphs won't get wider (in device pixels) as the user pinch zooms in.
+            This works as long as the scale on the context is >= 1. This patch ensures that a scaled down context won't blow up this gap.
+
+            Test: fast/text/large-synthetic-bold-with-scale-transform.html
+
+            * platform/graphics/cocoa/FontCascadeCocoa.mm:
+            (WebCore::FontCascade::drawGlyphs):
+
 2019-05-09  Antti Koivisto  <[email protected]>
 
         Elements with "display: inline-block" don't have a touch-action region

Modified: branches/safari-608.1.24-branch/Source/WebCore/platform/graphics/cocoa/FontCascadeCocoa.mm (245229 => 245230)


--- branches/safari-608.1.24-branch/Source/WebCore/platform/graphics/cocoa/FontCascadeCocoa.mm	2019-05-13 06:51:16 UTC (rev 245229)
+++ branches/safari-608.1.24-branch/Source/WebCore/platform/graphics/cocoa/FontCascadeCocoa.mm	2019-05-13 06:51:20 UTC (rev 245230)
@@ -276,8 +276,10 @@
     if (syntheticBoldOffset && !contextCTM.isIdentityOrTranslationOrFlipped()) {
         FloatSize horizontalUnitSizeInDevicePixels = contextCTM.mapSize(FloatSize(1, 0));
         float horizontalUnitLengthInDevicePixels = sqrtf(horizontalUnitSizeInDevicePixels.width() * horizontalUnitSizeInDevicePixels.width() + horizontalUnitSizeInDevicePixels.height() * horizontalUnitSizeInDevicePixels.height());
-        if (horizontalUnitLengthInDevicePixels)
-            syntheticBoldOffset /= horizontalUnitLengthInDevicePixels;
+        if (horizontalUnitLengthInDevicePixels) {
+            // Make sure that a scaled down context won't blow up the gap between the glyphs. 
+            syntheticBoldOffset = std::min(syntheticBoldOffset, syntheticBoldOffset / horizontalUnitLengthInDevicePixels);
+        }
     };
 
     bool hasSimpleShadow = context.textDrawingMode() == TextModeFill && shadowColor.isValid() && !shadowBlur && !platformData.isColorBitmapFont() && (!context.shadowsIgnoreTransforms() || contextCTM.isIdentityOrTranslationOrFlipped()) && !context.isInTransparencyLayer();
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to