nanosvg icon indicating copy to clipboard operation
nanosvg copied to clipboard

<use xlink:href> not working

Open JaimeIvanCervantes opened this issue 7 years ago • 3 comments

I am trying to render a very simple file with <use> elements, but it's not rendering correctly. Does nanosvg supports <use>? Here are the contents of my file:

<svg viewBox="0 0 400 100">
    <rect id="original-rect"
        x="100" y="20"
        width="50" height="50"
        fill="#29e" />

    <use xlink:href="#original-rect" x="150" y="10" />
</svg>

JaimeIvanCervantes avatar Apr 25 '17 02:04 JaimeIvanCervantes

Implementing this requires

  1. Add xform into NSVGshape structure.
  2. Transform a shape during rasterising or
  3. Make a transformed copy of the shape including all elements: bounds, path, gradients etc. during parsing.

SergeySlice avatar Jul 13 '18 09:07 SergeySlice

This feature would be very nice. Lots of SVG content has use tags!

jzrake avatar Mar 07 '19 20:03 jzrake

I have the same problem. We use nanosvg to parse svg file to support high dpi client. So many SVG content has <use> tags.

philipyexushen avatar Apr 25 '19 17:04 philipyexushen