From: Michael J G. <mic...@fa...> - 2008-09-09 07:29:36
|
Alan G Isaac venit, vidit, dixit 09.09.2008 06:36: > If I include an EPS file at 0,0 on a canvas and do nothing else, I > get an extra (and unwanted) 1px increase in the bounding box when I > write an EPS file. > > I assume this is a bug? The attached code may provide a good test case for tracking this down. It strokes a rectangle on a canvas, writes this to an eps, and includes that eps and writes it out to a new eps. Looking at epsbbox-inc.eps it seems that in the first step the bounding box is too large already: If the linewidth is 0.566929 and I stroke a rectangle at 0,0 then the left and bottom bbox should be -*half* of that (maybe plus 1 device pixel according to the read book), but not -2 times that, which is approximately what pyx seems to do. The same happens at the top and right borders for this example, so that the bbox comes out too large by an amount of approx. 3*linewidth (rather, 3.5*lw). After including the eps and writing it out, the generated eps has a highresbbox equal to the bbox (integral in PS user coords), which indicates that epsfile.epsfile doesn't read the HRbbox. It overshoots by 1 user coord in each direction, resulting in a 34x34 instead of a 32x32 bbox. That's for the experimental results. OK, I guess I'll look at the code now. I use EPS and bitmap inclusion from time to time and, once in a while, did notice misterious one pixel white space where I din't expect it. It may have to to with bbox issues. > PS Any hope of writing such a canvas to PDF one day? (I ask in total > ignorance of the tasks involved.) Being able to include a pdf would often be sufficient. Both provide different hurdles, though: eps can contain almost any ps command, but pdf allows a strict subset only; pdf does not have an "e" version, it can always be multipage. Michael |