From: Michael J G. <mic...@fa...> - 2008-09-09 14:52:44
|
Alan G Isaac venit, vidit, dixit 09.09.2008 15:48: > Here is a simple test. > Run the following Python script > > import pyx > pyx.unit.set(defaultunit='pt') > c = pyx.canvas.canvas() > c.insert(pyx.epsfile.epsfile(0, 0, "eg.eps")) > c.writeEPSfile('pyxout.eps') > > where eg.eps is below. Should get a bounding box > of 0 0 100 100. Right now (revision 3000) it is > off by 1 in every direction. This is caused by the default value bboxenlarge=1, and can be changed by using bboxenlarge=0 as an argument to writeEPSfile(). If you have integral values for the bbox then you don't need my patch. If you have non-integral values than with my patch (and the hiresbbox=1 option to epsfile.epsfile) the included eps file in PyX will have exactly the bbox specified in the eps (as opposed to the rounded values). > One comment: this is actually a big deal, for > graphics headed for publication. Yes. When I encountered it first I didn't know how to cope with it. > Good behavior > should be the default, imo. I did not fully understand > the linewidth argument: when I give you a bounding > box, that's it! Everything outside is clipped. > I cannot have a 1 point "halo" around the figure. Well, "good behaviour" for whom. By default the bbox (for the output) is determined by PyX. As Jörg explains, PyX doesn't know how to compute the bbox of a stroked path. At the joints it's certainly more difficult than just computing leftmost coordinate minus half linewidth etc. The default for bboxenlarge is a crude (sorry) fix for that. In fact, bounding boxes of stroked rectangles do change when I change the linewidth, so PyX takes them into account somehow. As Jörg points out, it's suboptimal that the bboxenlarge fix is applied to all canvas items. Michael |