On 10/09/2012 09:24, Jasper van de Gronde wrote:
On 09-09-12 14:13, Johan Engelen wrote:
On 9-9-2012 12:15, Tavmjong Bah wrote:
Hi,
Can someone quickly remind me what the problem is with the current SVG 'z' syntax to close a path?
I believe the 'problem' is that 'z' is not only a flag to tell the path is closed, it is also used to actually close the path with a straight line segment if the start and end points don't align. In our implementation (2geom), this implicit closing line segment is always there, also if the start and end points are equal. For new 2geom programmers, this can be confusing as the path length given by 2geom may not be the number of segments one sees in Inkscape. One always has to check for 'degenerate' (zero length) path segments.
Additionally, it leads to some funky problems in Inkscape's UI. Essentially, if a closed path starts and "ends" with a cubic Bézier, we try to hide the fact that there is actually another (zero-length) line segment in between. However, if you then use relative coordinates, or do other things that might lead to small numerical differences between the start and "end" node, then you suddenly do see the extra closing line segment (even though the structure of the path has not changed).
Related side-effect (AFAIU): mid-markers may differ for closed shapes
- Closed shapes with straight line segments only (e.g. polygons/stars) no longer render an additional mid-marker at the start-/ end-node with current (optimized) path data - see bug #403445 [1].
- Circle/ellipses render an unexpected mid-marker at the start-/ end-node, and 'orient="auto"' causes it to be misaligned wrt the outline of the shape.
- Objects based e.g. on rectangles with rounded corners may produce arbitrary results (depending on the type of last path segment - see bug #623739 [2]).
~suv
[1] https://bugs.launchpad.net/inkscape/+bug/403445 [2] https://bugs.launchpad.net/inkscape/+bug/623739