⚠ Archived content — this site is no longer maintained.   Current WebKit documentation is at docs.webkit.org.

Changeset 245230 in webkit


Ignore:
Timestamp:
May 12, 2019, 11:51:20 PM (7 years ago)
Author:
bshafiei@apple.com
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

Location:
branches/safari-608.1.24-branch
Files:
2 added
3 edited

Legend:

Unmodified
Added
Removed
  • branches/safari-608.1.24-branch/LayoutTests/ChangeLog

    r245225 r245230  
     12019-05-12  Babak Shafiei  <bshafiei@apple.com>
     2
     3        Cherry-pick r245191. rdar://problem/48027412
     4
     5    [iOS] baidu.com: Synthetic bold renders too far apart, appears doubled.
     6    https://bugs.webkit.org/show_bug.cgi?id=197781
     7    <rdar://problem/48027412>
     8   
     9    Reviewed by Simon Fraser.
     10   
     11    Source/WebCore:
     12   
     13    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
     14    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.
     15    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.
     16   
     17    Test: fast/text/large-synthetic-bold-with-scale-transform.html
     18   
     19    * platform/graphics/cocoa/FontCascadeCocoa.mm:
     20    (WebCore::FontCascade::drawGlyphs):
     21   
     22    LayoutTests:
     23   
     24    * fast/text/large-synthetic-bold-with-scale-transform-expected.html: Added.
     25    * fast/text/large-synthetic-bold-with-scale-transform.html: Added.
     26   
     27   
     28    git-svn-id: https://svn.webkit.org/repository/webkit/trunk@245191 268f45cc-cd09-0410-ab3c-d52691b4dbfc
     29
     30    2019-05-10  Zalan Bujtas  <zalan@apple.com>
     31
     32            [iOS] baidu.com: Synthetic bold renders too far apart, appears doubled.
     33            https://bugs.webkit.org/show_bug.cgi?id=197781
     34            <rdar://problem/48027412>
     35
     36            Reviewed by Simon Fraser.
     37
     38            * fast/text/large-synthetic-bold-with-scale-transform-expected.html: Added.
     39            * fast/text/large-synthetic-bold-with-scale-transform.html: Added.
     40
    1412019-05-12  Babak Shafiei  <bshafiei@apple.com>
    242
  • branches/safari-608.1.24-branch/Source/WebCore/ChangeLog

    r245126 r245230  
     12019-05-12  Babak Shafiei  <bshafiei@apple.com>
     2
     3        Cherry-pick r245191. rdar://problem/48027412
     4
     5    [iOS] baidu.com: Synthetic bold renders too far apart, appears doubled.
     6    https://bugs.webkit.org/show_bug.cgi?id=197781
     7    <rdar://problem/48027412>
     8   
     9    Reviewed by Simon Fraser.
     10   
     11    Source/WebCore:
     12   
     13    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
     14    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.
     15    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.
     16   
     17    Test: fast/text/large-synthetic-bold-with-scale-transform.html
     18   
     19    * platform/graphics/cocoa/FontCascadeCocoa.mm:
     20    (WebCore::FontCascade::drawGlyphs):
     21   
     22    LayoutTests:
     23   
     24    * fast/text/large-synthetic-bold-with-scale-transform-expected.html: Added.
     25    * fast/text/large-synthetic-bold-with-scale-transform.html: Added.
     26   
     27   
     28    git-svn-id: https://svn.webkit.org/repository/webkit/trunk@245191 268f45cc-cd09-0410-ab3c-d52691b4dbfc
     29
     30    2019-05-10  Zalan Bujtas  <zalan@apple.com>
     31
     32            [iOS] baidu.com: Synthetic bold renders too far apart, appears doubled.
     33            https://bugs.webkit.org/show_bug.cgi?id=197781
     34            <rdar://problem/48027412>
     35
     36            Reviewed by Simon Fraser.
     37
     38            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
     39            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.
     40            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.
     41
     42            Test: fast/text/large-synthetic-bold-with-scale-transform.html
     43
     44            * platform/graphics/cocoa/FontCascadeCocoa.mm:
     45            (WebCore::FontCascade::drawGlyphs):
     46
    1472019-05-09  Antti Koivisto  <antti@apple.com>
    248
  • branches/safari-608.1.24-branch/Source/WebCore/platform/graphics/cocoa/FontCascadeCocoa.mm

    r242325 r245230  
    277277        FloatSize horizontalUnitSizeInDevicePixels = contextCTM.mapSize(FloatSize(1, 0));
    278278        float horizontalUnitLengthInDevicePixels = sqrtf(horizontalUnitSizeInDevicePixels.width() * horizontalUnitSizeInDevicePixels.width() + horizontalUnitSizeInDevicePixels.height() * horizontalUnitSizeInDevicePixels.height());
    279         if (horizontalUnitLengthInDevicePixels)
    280             syntheticBoldOffset /= horizontalUnitLengthInDevicePixels;
     279        if (horizontalUnitLengthInDevicePixels) {
     280            // Make sure that a scaled down context won't blow up the gap between the glyphs.
     281            syntheticBoldOffset = std::min(syntheticBoldOffset, syntheticBoldOffset / horizontalUnitLengthInDevicePixels);
     282        }
    281283    };
    282284
Note: See TracChangeset for help on using the changeset viewer.