Comment 14 for bug 202540

Revision history for this message
Chris Mohler (cr33dog) wrote :

OK - so I have my hands on some new hardware and a spare moment to try and address this. Here's my understanding of the issue:

Extensions send SVG data to cubicsuperpath, which converts the SVG into a simple list of points. Which means the 'Z' attribute is lost when csp returns the list to simplepath for formatting as SVG again.

I've attached a proposed fix. It makes CubicSuperPath a class (instead of a function) with two attributes: csp (the exact same list a returned by the original function) and closed (boolean). There is also new code that removes the one or two extra nodes at the end of the path depending on if it was closed with a line or a curve then replaces the 'Z'. These are only removed if there was a 'Z' command to begin with, so it will not delete points on a non-closed path that just happens to have start and end points at the exact same spot.

The good: we can reliably know whether a path is closed or not.
The bad: I'd have to tweak every extension that makes a call to CubicSuperPath(). This patch contains the changes needed to make the Add Nodes extension work properly with the changes. It's very likely to cause other extensions to fail. However, the changes to the other extensions should be fairly trivial.

There's also a small tweak to simplepath.py to correct the command spacing in the SVG output (looking at the output was driving me insane).

So I'd like to get a little feedback before going ahead and adjusting every extension using cubicsuperpath.