Hi Florent, Thank you for your bug report. I just checked in a fix, a slight modification to your suggestion. Thanks a lot for reporting the issue and already tracking it down! The details can be found at https://sourceforge.net/p/pyx/bugs/62/
Recently I started using a laser cutter as well, and I'm happy to have PyX here, although for me it is way more natural to use PyX for that. Still, nice to hear it works for you as well. As you noticed, textpath does contain empty normsubpaths frequently. We do not filter them out. They occur mainly because in T1 the closepath command does not alter the current point where it does so for PostScript paths. Now, PyX resembles the postscript path model. To express a T1 closepath PyX thus does a closepath and then sets back the current point by an additional moveto. As the next sub-path of a glyph usually starts at some other position, another moveto is contained in the T1 commands of the glyph resulting in an empty normsubpath due to the double moveto. Note, that when relative movetos are used, the current point becomes important, and we cannot skip this additional moveto when constructing the path. Its just the way it works. We could filter it out in the end, but the issue would remain. Intersect should not break in case there just happens to be empty normsubpaths. Thanks for reporting this, it's clearly a bug. Best, André PS: Sorry for not providing an official backport to PyX 0.12, even though it is straight forward. Also, as you probably tried yourself already, you can just filter out empty normsubpaths (do it "inline" by p.normsubpaths = [normsubpath for normsubpath in p.normsubpaths if normsubpath]) to get it working without fixing PyX. Anyway, I'm pretty sure we won't have another 0.12.x release anymore, so sorry, no backport. Time to move on to Python 3 ... :-) Am 04.06.2015 um 19:03 schrieb Florent Hivert <[email protected]>: > Dear PyX developpers, > > First of all I'd like to thank you for your wonderful package. I'm using it > to draw pieces of puzzle which are then sent to a laser-cutter and it does a > great job (greater than matplotlib for this problem in my opinion). > > I'd like to report a small bug an to suggest a fix. The problem is the > following: I'm extracting some paths as border of letters from LateX and I > want to compute the intersection. The problem is that for some reason there is > an empty path extracted which is passed to intersect which is itself passed to > method normsubpath.segments() which doesn't accept empty pathes. > > Here is the precise error message: > > Traceback (most recent call last): > File "bug.py", line 11, in <module> > inter1, inter2 = p1.intersect(p2) > File "/usr/lib/python2.7/site-packages/pyx/normpath.py", line 1692, in > intersect > for intersection in zip(*normsubpath_a.intersect(normsubpath_b)): > File "/usr/lib/python2.7/site-packages/pyx/normpath.py", line 1079, in > intersect > closepoints_a = closepoints(self, intersections_a) > File "/usr/lib/python2.7/site-packages/pyx/normpath.py", line 1037, in > closepoints > split = normsubpath.segments([0] + [intersection for intersection, index > in intersections] + [len(normsubpath)]) > File "/usr/lib/python2.7/site-packages/pyx/normpath.py", line 1255, in > segments > segments = self.normsubpathitems[collectindex].segments(collectparams) > IndexError: list index out of range > > I filed a report on sourceforge with a suggestion of fix. > > Cheers, > > Florent Hivert > > ------------------------------------------------------------------------------ > _______________________________________________ > PyX-user mailing list > [email protected] > https://lists.sourceforge.net/lists/listinfo/pyx-user -- by _ _ _ Dr. André Wobst, Amselweg 22, 85716 Unterschleißheim / \ \ / ) [email protected], http://www.wobsta.de/ / _ \ \/\/ / PyX - High quality PostScript and PDF figures (_/ \_)_/\_/ with Python & TeX: visit http://pyx.sourceforge.net/
smime.p7s
Description: S/MIME cryptographic signature
------------------------------------------------------------------------------
_______________________________________________ PyX-user mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/pyx-user
