[cairo] Printer orientation bug in Win32

Ian ian at underpressuredivers.com
Fri Feb 25 17:53:59 PST 2011


> -----Original Message-----
> From: Ian [mailto:ian at underpressuredivers.com]
> 
> I recently reported a bug against GTK in Win32 that printing long lines to
a
> printer in landscape mode results in text at the end of the lines not
getting
> printed (https://bugzilla.gnome.org/show_bug.cgi?id=642655) but having
> just spent some time debugging it, it turns out to be a Cairo bug.
> 
> The bug is in function cairo_win32_printing_surface_create() in
> cairo_win32_printing_surface.c which sets up surface->extents.width and
> surface->extents.height from a call to the Windows API GetClipBox()
> function. That returns the extents correct for portrait orientation

After more debugging, it turns out to be a GTK bug after all, not Cairo.
When GTK launches the printer settings dialog it does not fill in the
orientation setting passed to it, so if an app needs to force landscape
orientation and does so in the GTK printer settings, that does not get
reflected in the dialog presented to the user which still says portrait, and
the Windows hDC gets created with the resultant portrait setting. So we end
up with GTK printing landscape format onto an hDC that was created with
portrait setting.

If the user checks the landscape box as well as the app forcing landscape
orientation then it works OK and the GetClipBox() call from
cairo_win32_printing_surface_create() returns the correct landscape
dimensions.

Back over to the GTK list...

Ian





More information about the cairo mailing list