When PyX computes the bbox of pattern canvases it tries to take the linewidth of stroked paths into account. Fix the case when the context does not know the linewidth.
Signed-off-by: Michael J Gruber <[email protected]> --- A minimal example is the following: from pyx import * p = pattern.pattern() c = canvas.canvas() p.stroke(path.line(0,0,1,1)) c.fill(path.rect(0,0,2,2), [p]) c.writePDFfile() For whatever reason, linewidth_pt is None in the active context. I'm pretty sure that the right fix would be to fix the context, and the above is just a band aid. Unfortunately, I have no idea about pdfwriter contexts. pyx/deco.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/pyx/deco.py b/pyx/deco.py index a5be92b..d4ba5de 100644 --- a/pyx/deco.py +++ b/pyx/deco.py @@ -282,7 +282,10 @@ class decoratedpath(baseclasses.canvasitem): strokepath.outputPDF(file, writer) file.write("S\n") # stroke # take linewidth into account for bbox when stroking a path - bbox += strokepath.bbox().enlarged_pt(0.5*acontext.linewidth_pt) + if acontext.linewidth_pt is None: + bbox += strokepath.bbox() + else: + bbox += strokepath.bbox().enlarged_pt(0.5*acontext.linewidth_pt) if self.strokestyles: file.write("Q\n") # grestore -- 2.10.0.rc1.279.gdb7c8d3 ------------------------------------------------------------------------------ _______________________________________________ PyX-devel mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/pyx-devel
