Closed odub closed 2 years ago
Hm, let me dig through the spec for path string parsing to figure out what your path string's even supposed to parse as. In all the years I've worked with SVG, this is literally the first time I'm seeing what you're showing. What produced it?
(the spec has this paragraph, which seems useful here: Similarly, for the string "M 0.6.5", the first coordinate of the "moveto" consumes the characters "0.6" and stops upon encountering the second decimal point because the production of a "coordinate" only allows one decimal point. The result is that the first coordinate will be "0.6" and the second coordinate will be ".5".
)
The input path was passed through svgo
After finding similar broken output from a bunch of other SVG parsers I only found one workaround in the end which was pretty nasty.
I used svgo's internal parser and some hacks on top of their serializer to get the path back into a less condensed form. I then used the expanded path that produced as input to this lib successfully.
https://github.com/svg/svgo/blob/master/lib/path.js#L135
I'm now left wondering whether these inputs should even have been supported in the first place. I don't have enough experience of the area to make that call, honestly. What do you think?
On Mon, 21 Jun 2021, 16:12 Pomax, @.***> wrote:
Hm, let me dig through the spec to figure out what your path string's even supposed to parse as. In all the years I've worked with SVG, this is literally the first time I'm seeing what you're showing. What produced it?
— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/Pomax/svg-path-reverse/issues/8#issuecomment-865114038, or unsubscribe https://github.com/notifications/unsubscribe-auth/AALVRPG3G2A2CEXTF57GK2TTT5JEFANCNFSM467KKO2Q .
It's technically legal syntax, SVG path strings follow a kind of weird "parse a number until the next character can't be part of that number, and start a new on", which is super stupid if you want efficient value parsing (without forcing folks to roll their own DFA just for splitting values), but it's in the spec, so having tools support it would be useful.
Hi, thanks for your work on this library
I noticed that reversing this particular path produces bad output:
I suspect could it be the
-
values? My other inputs up to this point have all worked great