Re: Printing on Win32

Hans Breuer wrote:

At 14:07 28.03.03 +0100, Ben Hetland wrote:
Finally it looks like the font stuff on Win32 printing looks sensible.

But, when I print (using "fit to page" scaling), it still seems to think
the paper is wider than it actually is (on A4), so the rightmost part
(1-2 cm) gets clipped against the right edge of the printable area on
the page. Also, an extra blank page seems to be emitted in this case.

The questionable code is in dia/plug.ins/wmf.cpp:end_render() in
the else branch. Or maybe the messing with the renderer->scale
far below. But beware that is also used for the wmf export case.

Yes, I'll see if I can find some time to look into it. I did quite some
messing around width this stuff about half a year or so ago, including
print preview, so I'll look back and see what I came up with. But one
thing I noted was the use of the GetDeviceCaps, though:

For printing devices: the width of the physical page, in device units.
For example, a printer set to print at 600 dpi on 8.5"x11" paper has a
physical width value of 5100 device units. Note that the physical page
is almost always greater than the printable area of the page, and never

(Quoted from MS's help system.)

Don't forget there's almost always a margin or an unprintable area on
the paper...

For MM_TEXT mapping mode I think I ended up using something à la

hres = W32::GetDeviceCaps( renderer->hAttribDC, LOGPIXELSX );
vres = W32::GetDeviceCaps( renderer->hAttribDC, LOGPIXELSY );
renderer->renderer.pixel_width = ceil( diagram_width * zoom *
(hres/2.54) );
renderer->renderer.pixel_height = ceil( diagram_height * zoom *
(vres/2.54) );
renderer->scalex = fabs(scale) * (hres / 2.54);
renderer->scaley = scale * (vres / 2.54);

I.e. for the renderer itself.



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]