Changeset 56460 in webkit


Ignore:
Timestamp:
Mar 24, 2010 2:37:22 PM (14 years ago)
Author:
evan@chromium.org
Message:

2010-03-23 Evan Martin <evan@chromium.org>

Reviewed by Dmitry Titov.

[chromium] use integral glyph widths
https://bugs.webkit.org/show_bug.cgi?id=36510

Extend a Linux Chromium layout test to also cover slight-hinted text.

  • platform/chromium/fast/text/chromium-linux-fontconfig-renderstyle.html:

2010-03-23 Evan Martin <evan@chromium.org>

Reviewed by Dmitry Titov.

[chromium] use integral glyph widths
https://bugs.webkit.org/show_bug.cgi?id=36510

Despite WebKit (and Skia, to an extent) supporting non-integral
glyph widths, the font code path we hit in Skia only supports
integral glyph positions. This means that we would accumulate
offsets when drawing a sequence up non-integer-width glyphs
which would cause gaps when snapped to the pixel grid when drawing.

  • platform/graphics/chromium/SimpleFontDataLinux.cpp: (WebCore::SimpleFontData::platformWidthForGlyph): round glyph widths to integers.
Location:
trunk
Files:
7 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r56446 r56460  
     12010-03-23  Evan Martin  <evan@chromium.org>
     2
     3        Reviewed by Dmitry Titov.
     4
     5        [chromium] use integral glyph widths
     6        https://bugs.webkit.org/show_bug.cgi?id=36510
     7
     8        Extend a Linux Chromium layout test to also cover slight-hinted text.
     9
     10        * platform/chromium/fast/text/chromium-linux-fontconfig-renderstyle.html:
     11
    1122010-03-24  Alexander Pavlov  <apavlov@chromium.org>
    213
  • trunk/LayoutTests/platform/chromium-linux/platform/chromium/fast/text/chromium-linux-fontconfig-renderstyle-expected.checksum

    r56278 r56460  
    1 e3133035298456c6bcc7bc9a7c1734cd
     13006f5be11df6bd89ba668286757ea2e
  • trunk/LayoutTests/platform/chromium-linux/platform/chromium/fast/text/chromium-linux-fontconfig-renderstyle-expected.txt

    r56278 r56460  
    44  RenderBlock {HTML} at (0,0) size 800x600
    55    RenderBody {BODY} at (8,8) size 784x576
    6       RenderBlock {P} at (0,0) size 784x20
    7         RenderText {#text} at (0,0) size 156x19
    8           text run at (0,0) width 156: "On Chromium Linux with "
     6      RenderBlock {P} at (0,0) size 784x40
     7        RenderText {#text} at (0,0) size 210x19
     8          text run at (0,0) width 210: "This test requires Chromium Linux "
    99        RenderInline {TT} at (0,0) size 80x16
    10           RenderText {#text} at (156,3) size 80x16
    11             text run at (156,3) width 80: "test_shell"
    12         RenderText {#text} at (236,0) size 18x19
    13           text run at (236,0) width 18: " in "
     10          RenderText {#text} at (210,3) size 80x16
     11            text run at (210,3) width 80: "test_shell"
     12        RenderText {#text} at (290,0) size 18x19
     13          text run at (290,0) width 18: " in "
    1414        RenderInline {TT} at (0,0) size 104x16
    15           RenderText {#text} at (254,3) size 104x16
    16             text run at (254,3) width 104: "--layout-test"
    17         RenderText {#text} at (358,0) size 42x19
    18           text run at (358,0) width 42: " mode "
    19         RenderInline {I} at (0,0) size 27x19
    20           RenderText {#text} at (400,0) size 27x19
    21             text run at (400,0) width 27: "only"
    22         RenderText {#text} at (427,0) size 317x19
    23           text run at (427,0) width 317: " the following text should render without anti-aliasing:"
    24       RenderBlock {P} at (0,36) size 784x19
    25         RenderText {#text} at (0,0) size 262x18
    26           text run at (0,0) width 262: "Testing fontconfig render preferences."
     15          RenderText {#text} at (308,3) size 104x16
     16            text run at (308,3) width 104: "--layout-test"
     17        RenderText {#text} at (412,0) size 750x39
     18          text run at (412,0) width 306: " mode, as that forces some rendering settings used "
     19          text run at (718,0) width 32: "in the"
     20          text run at (0,20) width 89: "following tests."
     21      RenderBlock {OL} at (0,56) size 784x145
     22        RenderListItem {LI} at (40,0) size 744x55
     23          RenderBlock {P} at (0,0) size 744x20
     24            RenderListMarker at (-21,0) size 16x19: "1"
     25            RenderText {#text} at (0,0) size 318x19
     26              text run at (0,0) width 318: "The following text should render without anti-aliasing:"
     27          RenderBlock {P} at (0,36) size 744x19
     28            RenderText {#text} at (0,0) size 154x18
     29              text run at (0,0) width 154: "Non anti-aliased sans."
     30        RenderListItem {LI} at (40,71) size 744x74
     31          RenderBlock {P} at (0,0) size 744x40
     32            RenderListMarker at (-21,0) size 16x19: "2"
     33            RenderText {#text} at (0,0) size 665x39
     34              text run at (0,0) width 315: "The following text should be slightly-hinted Georgia. "
     35              text run at (315,0) width 57: "The dots "
     36              text run at (372,0) width 293: "should be equally spaced, and letters in the word"
     37              text run at (0,20) width 84: "\"government\" "
     38              text run at (84,20) width 392: "should be naturally spaced (without an ugly space before the \"e\")."
     39          RenderBlock {P} at (0,56) size 744x18
     40            RenderText {#text} at (0,0) size 218x18
     41              text run at (0,0) width 218: "government ................................"
  • trunk/LayoutTests/platform/chromium/fast/text/chromium-linux-fontconfig-renderstyle.html

    r56162 r56460  
    11<html>
    2   <head>
    3     <style>
    4       p.aliased {
    5         font-family: "NonAntiAliasedSans";
    6       }
    7     </style>
    8   </head>
    92  <body>
    10     <p>On Chromium Linux with <tt>test_shell</tt> in <tt>--layout-test</tt> mode <i>only</i> the following text should render without anti-aliasing:</p>
     3    <p>This test requires Chromium Linux <tt>test_shell</tt> in
     4      <tt>--layout-test</tt> mode, as that forces some rendering settings used
     5      in the following tests.</p>
    116
    12     <p class="aliased">Testing fontconfig render preferences.</p>
     7    <ol>
     8      <li>
     9        <p>The following text should render without anti-aliasing:</p>
     10        <p style="font-family: NonAntiAliasedSans">Non anti-aliased sans.</p>
     11      </li>
     12      <li>
     13        <p>The following text should be slightly-hinted Georgia.  The dots
     14          should be equally spaced, and letters in the word "government"
     15          should be naturally spaced (without an ugly space before the "e").</p>
     16
     17        <p style="font-family:SlightHintedGeorgia">
     18          government ................................
     19        </p>
     20      </li>
     21    </ol>
    1322  </body>
    1423</html>
  • trunk/WebCore/ChangeLog

    r56459 r56460  
     12010-03-23  Evan Martin  <evan@chromium.org>
     2
     3        Reviewed by Dmitry Titov.
     4
     5        [chromium] use integral glyph widths
     6        https://bugs.webkit.org/show_bug.cgi?id=36510
     7
     8        Despite WebKit (and Skia, to an extent) supporting non-integral
     9        glyph widths, the font code path we hit in Skia only supports
     10        integral glyph positions.  This means that we would accumulate
     11        offsets when drawing a sequence up non-integer-width glyphs
     12        which would cause gaps when snapped to the pixel grid when drawing.
     13
     14        * platform/graphics/chromium/SimpleFontDataLinux.cpp:
     15        (WebCore::SimpleFontData::platformWidthForGlyph):
     16        round glyph widths to integers.
     17
    1182010-03-24  Dean Jackson  <dino@apple.com>
    219
  • trunk/WebCore/platform/graphics/chromium/SimpleFontDataLinux.cpp

    r44439 r56460  
    184184    SkScalar width = paint.measureText(&glyph, 2);
    185185
    186     return SkScalarToFloat(width);
     186    // Though WebKit supports non-integral advances, Skia only supports them
     187    // for "subpixel" (distinct from LCD subpixel antialiasing) text, which
     188    // we don't use.
     189    return round(SkScalarToFloat(width));
    187190}
    188191
Note: See TracChangeset for help on using the changeset viewer.