servo / pathfinder

A fast, practical GPU rasterizer for fonts and vector graphics
Apache License 2.0
3.56k stars 198 forks source link

Fixing svg parsing #464

Closed Vrroom closed 3 years ago

Vrroom commented 3 years ago
  1. Order of application of transformations: While processing a path the order of transformations are from the inner most to the outer most.

For example: In the graphic

<svg>
  <g transform=A>
    <g transform=B>
      <path ... />
    </g>
  </g>
</svg>

Path control points will be calculated by pre-multiplying with A B, not B A as per the current code.

  1. Applying transformation to clip paths: The transformations of the ancestors are applied to the clip path property of a path.

For example:

<svg>
  <defs>
    <clipPath id="clippath">
      <path id="clipper" ... />
    <clipPath/>
  </defs>
  <g transform=A>
    <path id="clippee" clip-path="url(#clippath)" ... />
  </g>
</svg>

Then, the transform A is applied to both the clippee and the clipper.