Changeset 56776 in webkit


Ignore:
Timestamp:
Mar 30, 2010 4:30:35 AM (14 years ago)
Author:
krit@webkit.org
Message:

2010-03-30 Dirk Schulze <krit@webkit.org>

Reviewed by Nikolas Zimmermann.

SVG Glyph transformations wrong on use of SVGFont
https://bugs.webkit.org/show_bug.cgi?id=36731

Kerning on SVGFonts should be applied to the userSpace of the current Char
and not to the userSpace of the viewport. This means scaling the kerning
to match the current userSpace.

Test: svg/custom/glyph-transformation-with-hkern.svg

  • rendering/SVGRootInlineBox.cpp: (WebCore::SVGRootInlineBox::buildLayoutInformationForTextBox):

2010-03-30 Dirk Schulze <krit@webkit.org>

Reviewed by Nikolas Zimmermann.

SVG Glyph transformations wrong on use of SVGFont
https://bugs.webkit.org/show_bug.cgi?id=36731

Test of correct scaled kerning, if userSpace on SVGFont doesn't
match the scaling of the viewport userSpace.

  • platform/mac/svg/W3C-SVG-1.1/fonts-kern-01-t-expected.txt:
  • platform/mac/svg/W3C-SVG-1.1/masking-mask-01-b-expected.txt:
  • platform/mac/svg/W3C-SVG-1.1/render-groups-01-b-expected.txt:
  • platform/mac/svg/W3C-SVG-1.1/render-groups-03-t-expected.txt:
  • platform/mac/svg/custom/scrolling-embedded-svg-file-image-repaint-problem-expected.txt:
  • svg/custom/glyph-transformation-with-hkern.svg: Added.
  • svg/custom/resources/SVGFreeSans.svg: Added.
Location:
trunk
Files:
5 added
8 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r56775 r56776  
     12010-03-30  Dirk Schulze  <krit@webkit.org>
     2
     3        Reviewed by Nikolas Zimmermann.
     4
     5        SVG Glyph transformations wrong on use of SVGFont
     6        https://bugs.webkit.org/show_bug.cgi?id=36731
     7
     8        Test of correct scaled kerning, if userSpace on SVGFont doesn't
     9        match the scaling of the viewport userSpace.
     10
     11        * platform/mac/svg/W3C-SVG-1.1/fonts-kern-01-t-expected.txt:
     12        * platform/mac/svg/W3C-SVG-1.1/masking-mask-01-b-expected.txt:
     13        * platform/mac/svg/W3C-SVG-1.1/render-groups-01-b-expected.txt:
     14        * platform/mac/svg/W3C-SVG-1.1/render-groups-03-t-expected.txt:
     15        * platform/mac/svg/custom/scrolling-embedded-svg-file-image-repaint-problem-expected.txt:
     16        * svg/custom/glyph-transformation-with-hkern.svg: Added.
     17        * svg/custom/resources/SVGFreeSans.svg: Added.
     18
    1192010-03-30  Dirk Schulze  <krit@webkit.org>
    220
  • trunk/LayoutTests/platform/mac/svg/W3C-SVG-1.1/fonts-kern-01-t-expected.txt

    r54483 r56776  
    1717          chunk 1 (middle anchor) text run 1 at (206.00,30.00) startOffset 0 endOffset 7 width 68.00: "<hkern>"
    1818      RenderSVGContainer {g} at (9,59) size 471x217 [transform={m=((1.00,0.00)(0.00,1.00)) t=(30.00,60.00)}]
    19         RenderSVGContainer {g} at (9,59) size 471x52
     19        RenderSVGContainer {g} at (9,59) size 222x52
    2020          RenderSVGContainer {g} at (9,59) size 22x52
    2121            RenderPath {rect} at (9,59) size 22x52 [stroke={[type=SOLID] [color=#000000]}] [data="M-20.00,0.00 L0.00,0.00 L0.00,50.00 L-20.00,50.00 Z"]
     
    3232            RenderSVGInlineText {#text} at (0,-11) size 73x14
    3333              chunk 1 text run 1 at (5.00,15.00) startOffset 0 endOffset 13 width 73.00: "u1=\"1\" u2=\"2\""
    34           RenderSVGContainer {g} at (31,81) size 449x28 [transform={m=((2.00,0.00)(0.00,2.00)) t=(5.00,45.00)}]
     34          RenderSVGContainer {g} at (31,81) size 54x28 [transform={m=((2.00,0.00)(0.00,2.00)) t=(5.00,45.00)}]
    3535            RenderSVGContainer {use} at (31,81) size 28x28
    3636              RenderSVGContainer {g} at (31,81) size 28x28
     
    4545                  RenderPath {line} at (59,103) size 26x4 [stroke={[type=SOLID] [color=#FF0000]}] [fill={[type=SOLID] [color=#8888FF]}] [data="M0.00,0.00 L12.00,0.00"]
    4646                  RenderPath {rect} at (55,101) size 10x8 [fill={[type=SOLID] [color=#FF0000]}] [data="M-2.00,-2.00 L2.00,-2.00 L2.00,2.00 L-2.00,2.00 Z"]
    47             RenderSVGText {text} at (0,0) size 1008x11 contains 1 chunk(s)
    48               RenderSVGInlineText {#text} at (0,-9) size 1008x11
     47            RenderSVGText {text} at (0,0) size 18x11 contains 1 chunk(s)
     48              RenderSVGInlineText {#text} at (0,-9) size 18x11
    4949                chunk 1 text run 1 at (0.00,0.00) startOffset 0 endOffset 2 width 7.50: "12"
    50         RenderSVGContainer {g} at (9,114) size 471x52 [transform={m=((1.00,0.00)(0.00,1.00)) t=(0.00,55.00)}]
     50        RenderSVGContainer {g} at (9,114) size 222x52 [transform={m=((1.00,0.00)(0.00,1.00)) t=(0.00,55.00)}]
    5151          RenderSVGContainer {g} at (9,114) size 22x52
    5252            RenderPath {rect} at (9,114) size 22x52 [stroke={[type=SOLID] [color=#000000]}] [data="M-20.00,0.00 L0.00,0.00 L0.00,50.00 L-20.00,50.00 Z"]
     
    6363            RenderSVGInlineText {#text} at (0,-14) size 138x18
    6464              chunk 1 text run 1 at (5.00,15.00) startOffset 0 endOffset 19 width 138.00: "g1=\"gl_1\" g2=\"gl_2\""
    65           RenderSVGContainer {g} at (31,136) size 449x28 [transform={m=((2.00,0.00)(0.00,2.00)) t=(5.00,45.00)}]
     65          RenderSVGContainer {g} at (31,136) size 74x28 [transform={m=((2.00,0.00)(0.00,2.00)) t=(5.00,45.00)}]
    6666            RenderSVGContainer {use} at (31,136) size 28x28
    6767              RenderSVGContainer {g} at (31,136) size 28x28
     
    7676                  RenderPath {line} at (79,158) size 26x4 [stroke={[type=SOLID] [color=#FF0000]}] [fill={[type=SOLID] [color=#8888FF]}] [data="M0.00,0.00 L12.00,0.00"]
    7777                  RenderPath {rect} at (75,156) size 10x8 [fill={[type=SOLID] [color=#FF0000]}] [data="M-2.00,-2.00 L2.00,-2.00 L2.00,2.00 L-2.00,2.00 Z"]
    78             RenderSVGText {text} at (0,0) size 2008x11 contains 1 chunk(s)
    79               RenderSVGInlineText {#text} at (0,-9) size 2008x11
     78            RenderSVGText {text} at (0,0) size 28x11 contains 1 chunk(s)
     79              RenderSVGInlineText {#text} at (0,-9) size 28x11
    8080                chunk 1 text run 1 at (0.00,0.00) startOffset 0 endOffset 2 width 7.50: "12"
    8181        RenderSVGContainer {g} at (9,169) size 266x52 [transform={m=((1.00,0.00)(0.00,1.00)) t=(0.00,110.00)}]
     
    223223            RenderSVGInlineText {#text} at (0,-14) size 208x18
    224224              chunk 1 text run 1 at (5.00,15.00) startOffset 0 endOffset 26 width 208.00: "u1=\"U+003?\" u2=\"U+0031-34\""
    225           RenderSVGContainer {g} at (271,136) size 209x28 [transform={m=((2.00,0.00)(0.00,2.00)) t=(5.00,45.00)}]
     225          RenderSVGContainer {g} at (271,136) size 168x28 [transform={m=((2.00,0.00)(0.00,2.00)) t=(5.00,45.00)}]
    226226            RenderSVGContainer {use} at (271,136) size 28x28
    227227              RenderSVGContainer {g} at (271,136) size 28x28
     
    248248                  RenderPath {line} at (415,158) size 24x4 [stroke={[type=SOLID] [color=#FF0000]}] [fill={[type=SOLID] [color=#8888FF]}] [data="M0.00,0.00 L12.00,0.00"]
    249249                  RenderPath {rect} at (411,156) size 8x8 [fill={[type=SOLID] [color=#FF0000]}] [data="M-2.00,-2.00 L2.00,-2.00 L2.00,2.00 L-2.00,2.00 Z"]
    250             RenderSVGText {text} at (0,0) size 4535x11 contains 1 chunk(s)
    251               RenderSVGInlineText {#text} at (0,-9) size 4535x11
    252                 chunk 1 text run 1 at (0.00,0.00) startOffset 0 endOffset 4 width 35.00: "1234"
    253         RenderSVGContainer {g} at (249,169) size 231x52 [transform={m=((1.00,0.00)(0.00,1.00)) t=(240.00,110.00)}]
     250            RenderSVGText {text} at (0,0) size 80x11 contains 1 chunk(s)
     251              RenderSVGInlineText {#text} at (0,-9) size 80x11
     252                chunk 1 text run 1 at (0.00,0.00) startOffset 0 endOffset 4 width 35.00: "1234"
     253        RenderSVGContainer {g} at (249,169) size 222x52 [transform={m=((1.00,0.00)(0.00,1.00)) t=(240.00,110.00)}]
    254254          RenderSVGContainer {g} at (249,169) size 22x52
    255255            RenderPath {rect} at (249,169) size 22x52 [stroke={[type=SOLID] [color=#000000]}] [data="M-20.00,0.00 L0.00,0.00 L0.00,50.00 L-20.00,50.00 Z"]
     
    266266            RenderSVGInlineText {#text} at (0,-14) size 118x18
    267267              chunk 1 text run 1 at (5.00,15.00) startOffset 0 endOffset 16 width 118.00: "u1=\"1\" g2=\"gl_2\""
    268           RenderSVGContainer {g} at (271,191) size 209x28 [transform={m=((2.00,0.00)(0.00,2.00)) t=(5.00,45.00)}]
     268          RenderSVGContainer {g} at (271,191) size 60x28 [transform={m=((2.00,0.00)(0.00,2.00)) t=(5.00,45.00)}]
    269269            RenderSVGContainer {use} at (271,191) size 28x28
    270270              RenderSVGContainer {g} at (271,191) size 28x28
     
    279279                  RenderPath {line} at (299,213) size 26x4 [stroke={[type=SOLID] [color=#FF0000]}] [fill={[type=SOLID] [color=#8888FF]}] [data="M0.00,0.00 L12.00,0.00"]
    280280                  RenderPath {rect} at (295,211) size 10x8 [fill={[type=SOLID] [color=#FF0000]}] [data="M-2.00,-2.00 L2.00,-2.00 L2.00,2.00 L-2.00,2.00 Z"]
    281             RenderSVGText {text} at (0,0) size 1018x11 contains 1 chunk(s)
    282               RenderSVGInlineText {#text} at (0,-9) size 1018x11
     281            RenderSVGText {text} at (0,0) size 28x11 contains 1 chunk(s)
     282              RenderSVGInlineText {#text} at (0,-9) size 28x11
    283283                chunk 1 text run 1 at (0.00,0.00) startOffset 0 endOffset 2 width 17.50: "12"
    284284      RenderSVGContainer {g} at (0,0) size 0x0 [transform={m=((1.00,0.00)(0.00,1.00)) t=(320.00,100.00)}]
  • trunk/LayoutTests/platform/mac/svg/W3C-SVG-1.1/masking-mask-01-b-expected.txt

    r54991 r56776  
    4040        RenderPath {rect} at (60,250) size 200x25 [fill={[type=SOLID] [color=#FFFFFF]}] [data="M60.00,250.00 L260.00,250.00 L260.00,275.00 L60.00,275.00 Z"]
    4141        RenderPath {rect} at (60,275) size 200x25 [fill={[type=SOLID] [color=#FFFFFF] [opacity=0.70]}] [data="M60.00,275.00 L260.00,275.00 L260.00,300.00 L60.00,300.00 Z"]
    42       RenderSVGText {text} at (60,280) size 162x110 contains 1 chunk(s)
     42      RenderSVGText {text} at (60,280) size 126x110 contains 1 chunk(s)
    4343        [masker="mask3"] RenderSVGResourceMasker {mask} at (60,200) size 200x100
    44         RenderSVGInlineText {#text} at (0,-77) size 162x110
     44        RenderSVGInlineText {#text} at (0,-77) size 126x110
    4545          [masker="mask3"] RenderSVGResourceMasker {mask} at (60,200) size 200x100
    4646          chunk 1 text run 1 at (60.00,280.00) startOffset 0 endOffset 3 width 121.33: "SVG"
  • trunk/LayoutTests/platform/mac/svg/W3C-SVG-1.1/render-groups-01-b-expected.txt

    r54483 r56776  
    1717        RenderPath {rect} at (34,16) size 418x283 [stroke={[type=SOLID] [color=#000000]}] [data="M20.00,10.00 L250.00,10.00 L250.00,165.00 L20.00,165.00 Z"]
    1818        RenderSVGContainer {g} at (54,10) size 382x269 [opacity=0.50]
    19           RenderSVGText {text} at (30,90) size 173x120 contains 1 chunk(s)
    20             RenderSVGInlineText {#text} at (0,-84) size 173x120
     19          RenderSVGText {text} at (30,90) size 138x120 contains 1 chunk(s)
     20            RenderSVGInlineText {#text} at (0,-84) size 138x120
    2121              chunk 1 text run 1 at (30.00,90.00) startOffset 0 endOffset 3 width 132.36: "SVG"
    2222          RenderPath {rect} at (126,99) size 234x126 [fill={[type=SOLID] [color=#820032]}] [data="M70.00,55.00 L200.00,55.00 L200.00,125.00 L70.00,125.00 Z"]
  • trunk/LayoutTests/platform/mac/svg/W3C-SVG-1.1/render-groups-03-t-expected.txt

    r54483 r56776  
    1616        RenderPath {line} at (435,18) size 30x297 [stroke={[type=SOLID] [color=#FFFFFF] [stroke width=15.00]}] [fill={[type=SOLID] [color=#000000]}] [data="M250.00,10.00 L250.00,175.00"]
    1717        RenderPath {rect} at (34,16) size 418x283 [stroke={[type=SOLID] [color=#000000]}] [data="M20.00,10.00 L250.00,10.00 L250.00,165.00 L20.00,165.00 Z"]
    18         RenderSVGText {text} at (30,90) size 173x120 contains 1 chunk(s)
    19           RenderSVGInlineText {#text} at (0,-84) size 173x120
     18        RenderSVGText {text} at (30,90) size 138x120 contains 1 chunk(s)
     19          RenderSVGInlineText {#text} at (0,-84) size 138x120
    2020            chunk 1 text run 1 at (30.00,90.00) startOffset 0 endOffset 3 width 132.36: "SVG"
    2121        RenderPath {rect} at (126,99) size 234x126 [fill={[type=SOLID] [color=#820032]}] [data="M70.00,55.00 L200.00,55.00 L200.00,125.00 L70.00,125.00 Z"]
  • trunk/LayoutTests/platform/mac/svg/custom/scrolling-embedded-svg-file-image-repaint-problem-expected.txt

    r54483 r56776  
    7474                                RenderPath {rect} at (34,16) size 418x283 [stroke={[type=SOLID] [color=#000000]}] [data="M20.00,10.00 L250.00,10.00 L250.00,165.00 L20.00,165.00 Z"]
    7575                                RenderSVGContainer {g} at (54,10) size 382x269 [opacity=0.50]
    76                                   RenderSVGText {text} at (30,90) size 173x120 contains 1 chunk(s)
    77                                     RenderSVGInlineText {#text} at (0,-84) size 173x120
     76                                  RenderSVGText {text} at (30,90) size 138x120 contains 1 chunk(s)
     77                                    RenderSVGInlineText {#text} at (0,-84) size 138x120
    7878                                      chunk 1 text run 1 at (30.00,90.00) startOffset 0 endOffset 3 width 132.36: "SVG"
    7979                                  RenderPath {rect} at (126,99) size 234x126 [fill={[type=SOLID] [color=#820032]}] [data="M70.00,55.00 L200.00,55.00 L200.00,125.00 L70.00,125.00 Z"]
  • trunk/WebCore/ChangeLog

    r56775 r56776  
     12010-03-30  Dirk Schulze  <krit@webkit.org>
     2
     3        Reviewed by Nikolas Zimmermann.
     4
     5        SVG Glyph transformations wrong on use of SVGFont
     6        https://bugs.webkit.org/show_bug.cgi?id=36731
     7
     8        Kerning on SVGFonts should be applied to the userSpace of the current Char
     9        and not to the userSpace of the viewport. This means scaling the kerning
     10        to match the current userSpace.
     11
     12        Test: svg/custom/glyph-transformation-with-hkern.svg
     13
     14        * rendering/SVGRootInlineBox.cpp:
     15        (WebCore::SVGRootInlineBox::buildLayoutInformationForTextBox):
     16
    1172010-03-30  Dirk Schulze  <krit@webkit.org>
    218
  • trunk/WebCore/rendering/SVGRootInlineBox.cpp

    r54858 r56776  
    2929
    3030#include "Editor.h"
     31#include "FloatConversion.h"
    3132#include "Frame.h"
    3233#include "GraphicsContext.h"
     
    14141415        }
    14151416
    1416         double kerning = 0.0;
     1417        float kerning = 0.0f;
    14171418#if ENABLE(SVG_FONTS)
    14181419        SVGFontElement* svgFont = 0;
     
    14231424            SVGHorizontalKerningPair kerningPair;
    14241425            if (svgFont->getHorizontalKerningPairForStringsAndGlyphs(lastGlyph.unicode, lastGlyph.glyphName, unicodeStr, glyphName, kerningPair))
    1425                 kerning = kerningPair.kerning;
     1426                kerning = narrowPrecisionToFloat(kerningPair.kerning);
    14261427        }
    14271428
     
    14301431            lastGlyph.glyphName = glyphName;
    14311432            lastGlyph.isValid = true;
     1433            kerning *= style->font().size() / style->font().primaryFont()->unitsPerEm();
    14321434        } else
    14331435            lastGlyph.isValid = false;
    14341436#endif
    14351437
    1436         svgChar.x -= (float)kerning;
     1438        svgChar.x -= kerning;
    14371439
    14381440        // Advance to new position
     
    14411443            info.cury += glyphAdvance + spacing;
    14421444        } else
    1443             info.curx += glyphAdvance + spacing - (float)kerning;
     1445            info.curx += glyphAdvance + spacing - kerning;
    14441446
    14451447        // Advance to next character group
Note: See TracChangeset for help on using the changeset viewer.