From: Jasper van de Gronde <th.v.d.gronde@hc...> - 2009-12-18 10:37:13
Aaron Spike wrote:
> So what can you do? Well, I haven't thought through this yet. But maybe
> you could make csp's inner lists a special list subclass that has a
> property for the closedness.
There are a number of tricky issues in SVG paths in general. Apart from
the closedness issue you also have, for example, that:
M 0,0 M 1,1 L 2,2
Is not the same as:
M 1,1 L 2,2
In the sense that they can actually result in different things being
displayed if markers are used. So in general it is indeed advisable to
keep represent SVG paths exactly as they are given. (If I remember
correctly something similar applies for M 0,0 L 1,1 z compared with M
0,0 L 1,1 L 0,0 z; let alone M 0,0 L 1,1 L 0,0.)
> Or maybe you could add an optional
> parameter to formatPath (or a new function, if that is better API) that
> closes the path if the first and last points are coincident.
I'm not completely familiar with the specifics of this module, but
closing a path if the first and last points are coincident is NOT a good
idea. This is something that has finally been eliminated from Inkscape
itself (if I remember correctly), and it is NOT a good idea to introduce
this in the extensions.
Frankly I'm wondering if we can't expose Inkscape's SVG path
reading/writing to our Python extensions. Quite a lot of work has gone
into making sure that they work correctly (and fast), why not leverage
that? It would only involve wrapping svg/svg-path.cpp, svg/path-string
and (parts of) lib2geom, all reasonably self-contained.