Open mondeja opened 4 years ago
Path("M0,0a1 1 0 00-1-1z")
The issue here is that the a
command actually has XBNF that says the large arc flag and the sweep flag are literally flags. Their value can be 0
or 1
and those values only. But, since they can't have additional digits it's legal to combined them. Here the program issues those flags as "00" in a single object. However, due to the parsing of the SVG catching this requires a rewrite of the parser. I did that in svgelements
for a different reasons. Mostly it was really hard for me to parse the z suffixing code in svg 2.0 spec.
See regebro/svg.path#53 for some more specifics on this. This bug also causes the library to fail a couple W3C tests.
The solution would be to switch out the parser completely for my rewrite. Not sure @mathandy 's position on that but it's easy to prove it correctly works. Though I usually limit myself to one pull at a time and I still have #130 open. The immediate solution would be if you don't need any of the more advanced math stuff and you want more robust svg parsing with strong adherence to the spec you could switch to svgelements.
https://github.com/meerk40t/svgelements
I use my project in a somewhat popular lasercutting project so it gets hit with a bunch of different SVG files all the time and should work fairly robustly. I come back here for ideas and to steal math.
I've mixed the other issue with this.
This SVG path:
...which you can see rendered here raises next exception trying to parse it:
Minimal reproducible example
This SVG path:
...which you can see rendered here raises next exception trying to parse it:
Minimal reproducible example