WebKit Bugzilla
Attachment 369553 Details for
Bug 197781
: [iOS] baidu.com: Synthetic bold renders too far apart, appears doubled.
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
Patch
bug-197781-20190510093209.patch (text/plain), 4.88 KB, created by
zalan
on 2019-05-10 09:32:10 PDT
(
hide
)
Description:
Patch
Filename:
MIME Type:
Creator:
zalan
Created:
2019-05-10 09:32:10 PDT
Size:
4.88 KB
patch
obsolete
>Subversion Revision: 245158 >diff --git a/Source/WebCore/ChangeLog b/Source/WebCore/ChangeLog >index 7de812b3f6ffd199b8c6045d2e875d7df71bedd8..b351955d724a1fb74c6b16942ab4799386b4b6a2 100644 >--- a/Source/WebCore/ChangeLog >+++ b/Source/WebCore/ChangeLog >@@ -1,3 +1,20 @@ >+2019-05-10 Zalan Bujtas <zalan@apple.com> >+ >+ [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 NOBODY (OOPS!). >+ >+ 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 Zalan Bujtas <zalan@apple.com> > > Do not mix inline and block level boxes. >diff --git a/Source/WebCore/platform/graphics/cocoa/FontCascadeCocoa.mm b/Source/WebCore/platform/graphics/cocoa/FontCascadeCocoa.mm >index 9ad8ffec84413f454eb60b24129eff09b9ac2822..f599b4e6bd0ca767f502f21bf68f5146e0c9a103 100644 >--- a/Source/WebCore/platform/graphics/cocoa/FontCascadeCocoa.mm >+++ b/Source/WebCore/platform/graphics/cocoa/FontCascadeCocoa.mm >@@ -276,8 +276,10 @@ void FontCascade::drawGlyphs(GraphicsContext& context, const Font& font, const G > 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(); >diff --git a/LayoutTests/ChangeLog b/LayoutTests/ChangeLog >index 93408f4d0cb0610b51b85a90157321222681ebab..085b531d2729e4c4a5577b53ea84aff2c6f76c5c 100644 >--- a/LayoutTests/ChangeLog >+++ b/LayoutTests/ChangeLog >@@ -1,3 +1,14 @@ >+2019-05-10 Zalan Bujtas <zalan@apple.com> >+ >+ [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 NOBODY (OOPS!). >+ >+ * fast/text/large-synthetic-bold-with-scale-transform-expected.html: Added. >+ * fast/text/large-synthetic-bold-with-scale-transform.html: Added. >+ > 2019-05-08 Zalan Bujtas <zalan@apple.com> > > Do not mix inline and block level boxes. >diff --git a/LayoutTests/fast/text/large-synthetic-bold-with-scale-transform-expected.html b/LayoutTests/fast/text/large-synthetic-bold-with-scale-transform-expected.html >new file mode 100644 >index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 >diff --git a/LayoutTests/fast/text/large-synthetic-bold-with-scale-transform.html b/LayoutTests/fast/text/large-synthetic-bold-with-scale-transform.html >new file mode 100644 >index 0000000000000000000000000000000000000000..44702d07da614058eb647df1ab06eeb2215aa17c >--- /dev/null >+++ b/LayoutTests/fast/text/large-synthetic-bold-with-scale-transform.html >@@ -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>
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Formatted Diff
|
Diff
Attachments on
bug 197781
: 369553 |
369571