[cairo] How do you get tight bounding boxes and/or unused margins cropped for final libcairo results?
Alan W. Irwin
irwin at beluga.phys.uvic.ca
Mon Sep 10 20:14:37 PDT 2007
On 2007-09-11 08:13+0930 Adrian Johnson wrote:
> The currently set bounding box does not comply with the PostScript
> Document Structuring Convention specifications which requires a tight
> bounding box for each page. I have been working on fixing this while
> working on extending the PostScript backend to generated Encapsulated
> PostScript. EPS requires the correct bounding bounding box to ensure an
> imported EPS file is embedded at the correct size.
There are two distinct but closely related issues here.
(1) Cropping of unused margins.
How difficult would it be for each backend to implement a libcairo API that
would allow outputting just a rectangular subset of the image? This would
allow users to trim off unused margins of a fully formed image just before
it was output using the calculated global extent of the image without having
to implement any replay tricks.
(2) Bounding box
Of course, once such a desired rectangular subset was passed to the
PostScript backend, the bounding box would have to be adjusted as well to be
consistent with what you say about the PostScript standard above. I
understand both the PDF and SVG formats also support some sort of bounding
box (a quick google search seems to indicate it should be called CropBox in
the PDF case). Can your work on creating tight bounding boxes be generalized
to those backends?
Alan W. Irwin
Astronomical research affiliation with Department of Physics and Astronomy,
University of Victoria (astrowww.phys.uvic.ca).
Programming affiliations with the FreeEOS equation-of-state implementation
for stellar interiors (freeeos.sf.net); PLplot scientific plotting software
package (plplot.org); the libLASi project (unifont.org/lasi); the Loads of
Linux Links project (loll.sf.net); and the Linux Brochure Project
More information about the cairo