I'm trying to convert SVG files that come as output from a command line tool (abcm2ps) into Android vector drawables, but I'm running into problems.
My process is as follows:
- Create the original SVG file using the tool mentioned above
- Run the SVG file through Inkscape to fix the page size
- Run the result through Inkscape again to save as Plain SVG (read somewhere that this might fix problems, doesn't help though)
- Try to import the SVG file into Android Studio to no avail
I'm getting errors saying that some referenced IDs can not be found. I looked into the XML file and noticed that this error occurs only for references that again contain references. Example:
<defs
id="defs6633">
<path
id="usharp"
class="fill"
d="m 136,-702 v 890 h 32 v -890 m 128,840 h 32 V -750 H 296 M 64,-464 v 116 l 338,-96 V -560 M 64,-118 V -2 l 338,-98 v -114"
inkscape:connector-curvature="0"
style="fill:currentColor" />
<use
id="sh0"
transform="matrix(0.018,0,0,0.018,-4,5)"
xlink:href="#usharp"
x="0"
y="0"
width="100%"
height="100%" />
</defs>
<use
x="44.5"
y="20"
xlink:href="#sh0"
id="use6635"
width="100%"
height="100%" />
As you can see, object use6635
references sh0
, which again references usharp
.
Other places where the referenced object does not reference another object work, though.
This this a known limitation of the converter? Is there a way (preferrably a command line tool) to flatten the reference hierarchy so that only objects are referenced that don't reference other objects?
EDIT: OK, converting to EPS and then to SVG creates SVGs that are processed without the warning above - I now get warnings saying that scaled stroke widths are not supported...