Closed usr-ein closed 2 years ago
This might be related to the recent changes resulted in the implementation of tests, basically I found many lines never executed with "valid" path strings. In my books this string
m133.67 263.88
-28.317-13.209
-26.934 15.839
3.8116-31.013
-23.387-20.722
30.673-5.9585
12.48-28.646
15.145 27.33
31.1 3.0176
-21.313 22.85
z
is an invalid string, since M/m is configured to always parse 2 numerical parameters. The reason I say this is because the original source of the parser (SVGPath) at its time, the SVG working draft was pretty messed up, it had to be decided to simplify the logic somehow to have a working script to get the job done for them (Fontello).
However if reverting some of the recent changes fixes that, I'm happy to do it. Perhaps you would care to test some of the previous versions to confirm? Would save us some much needed time.
Thanks for the report.
Update, I did a quick test with v0.1.25 and it has the same behavior. I have no solution right now, I can only suggest to configure Inkskape to export 100% valid path strings if possible.
We are also open to any code change suggestion.
Update: you ready to test a new build?
@sam1902 please disregard my previous posts and confirm the latest build is valid for you, we're ready to publish as soon as you confirm.
@sam1902 ?
Yep, fixed for me! I re-ran the above test HTML/JS code and now the output is:
M133.67 263.88
L105.353 250.671
L78.419 266.51
L82.2306 235.497
L58.8436 214.775
L89.5166 208.8165
L101.9966 180.1705
L117.1416 207.5005
L148.2416 210.5181
L126.9286 233.3681Z
As you can see, lineTo
s are now correctly used instead of moveTo
s.
Thank you for quickly fixing this 💯
Here is the doc for the relative
moveTo
:Replication
The following path describes a star shape (one of Inkscape's primitives):
However, it uses the implicit
lineTo
mentionned in the doc. Thus, it is equivalent to that:However, SVG Path Commander, when asked to rescale it, will convert every subsequent pair of
moveTo
parameter into newmoveTo
commands, which is not the behaviour described in the doc. Hence, the above, when scaled byscale: 1
will become:Which doesn't draw anything (it just moves the starting point around). Instead, it should look like this:
which is the same as