[cairo] cairo macros and public API

Chris Vine chris at cvine.freeserve.co.uk
Wed Sep 3 17:16:29 PDT 2008


On Wed, 03 Sep 2008 16:31:52 -0700
Carl Worth <cworth at cworth.org> wrote:
[snip]
> > It is working quite well, although after scaling the tiff pixel data
> > with cairo_scale() to the pixel size of the page printing area
> > offered by the GtkPrintContext object passed by the GTK+ printing
> > functions, for some reason there is some over-scaling (diminishing)
> > of the image, even when setting page margins to 0, but it is
> > without the bounds of usability.
> 
> Hmm...
> 
> It would of course be better if you could get exactly the result
> you're after, (and we like cairo to act very predictably, so we'd
> love to fix it if it isn't). Could you provide more detail here? Such
> as minimal code demonstrating the problem as well as the buggy result
> and the desired result?

Sorry, I meant within the bounds of usability, not outside the bounds
of usability.

The tiff images are in fact whole-page fax images.  You can see the
effect by loading a tiff image representing an entire page in eog, and
then printing the page from eog (or viewing it from the preview button
in the eog print dialog).  The length of the printed image will be
about 5% too short, even with page margins set to 0.

That is a minimal example, but I cannot offer minimal code.  My
implementation is in the CVS repository of efax-gtk at sourceforge,
which if you are interested (and I quite understand that you may not
be) you can download with:

cvs -d:pserver:anonymous at efax-gtk.cvs.sourceforge.net:/cvsroot/efax-gtk login
[enter for password]
cvs -z3 -d:pserver:anonymous at efax-gtk.cvs.sourceforge.net:/cvsroot/efax-gtk co efax-gtk

If you can get a fax sent to you the effect can be seen by comparing
printed output using direct tiff to ps conversion (that is by not
choosing to use the GTK+ print system in the efax-gtk settings dialog)
and by choosing the GTK+ print system (which as in the case of eog uses
cairo to render the pages in the draw-page callback). cairo overscales
downwards by about 5%, which can be overcome by scaling back up by 5%
by choosing 105% scaling in the print dialog.

It doesn't appear to be a GTK+ problem, because if text is rendered to
cairo surfaces with pango/pangocairo with page margins set to 0 and the
page pixel sizes offered by GtkPrintContext, the text will appear
correctly sized without margins.

Chris



More information about the cairo mailing list