Changeset 245191 in webkit


Ignore:
Timestamp:
May 10, 2019 1:30:05 PM (5 years ago)
Author:
Alan Bujtas
Message:

[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.
Location:
trunk
Files:
2 added
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r245181 r245191  
     12019-05-10  Zalan Bujtas  <zalan@apple.com>
     2
     3        [iOS] baidu.com: Synthetic bold renders too far apart, appears doubled.
     4        https://bugs.webkit.org/show_bug.cgi?id=197781
     5        <rdar://problem/48027412>
     6
     7        Reviewed by Simon Fraser.
     8
     9        * fast/text/large-synthetic-bold-with-scale-transform-expected.html: Added.
     10        * fast/text/large-synthetic-bold-with-scale-transform.html: Added.
     11
    1122019-05-10  Simon Fraser  <simon.fraser@apple.com>
    213
  • trunk/Source/WebCore/ChangeLog

    r245190 r245191  
     12019-05-10  Zalan Bujtas  <zalan@apple.com>
     2
     3        [iOS] baidu.com: Synthetic bold renders too far apart, appears doubled.
     4        https://bugs.webkit.org/show_bug.cgi?id=197781
     5        <rdar://problem/48027412>
     6
     7        Reviewed by Simon Fraser.
     8
     9        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
     10        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.
     11        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.
     12
     13        Test: fast/text/large-synthetic-bold-with-scale-transform.html
     14
     15        * platform/graphics/cocoa/FontCascadeCocoa.mm:
     16        (WebCore::FontCascade::drawGlyphs):
     17
    1182019-05-10  Brent Fulgham  <bfulgham@apple.com>
    219
  • trunk/Source/WebCore/platform/graphics/cocoa/FontCascadeCocoa.mm

    r242325 r245191  
    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.