Board index » delphi » printer.canvas.textheight and printer resolution

printer.canvas.textheight and printer resolution

Why does textheight not return the double when you double the printer
resolution?
Example: i:= printer.canvas.textheight("xyz")
         i is 64 (with 300 dpi printer resolution)
     but i is 113 (with 600 dpi printer res)
     why not 128?
This cause problem with line spacing. The lines of a text in 300 dpi is
closer than the lines of a 600 dpi text.
How can i ensure that the line space is always the same?

Thanks for any hints
Daniel

 

Re:printer.canvas.textheight and printer resolution


Quote
Daniel Ponti wrote:

> Why does textheight not return the double when you double the printer
> resolution?
> Example: i:= printer.canvas.textheight("xyz")
>          i is 64 (with 300 dpi printer resolution)
>      but i is 113 (with 600 dpi printer res)
>      why not 128?
> This cause problem with line spacing. The lines of a text in 300 dpi is
> closer than the lines of a 600 dpi text.
> How can i ensure that the line space is always the same?

> Thanks for any hints
> Daniel

I would advise you to use millimeters or inches and not pixels
when you deal with printing. Call SetMapMode() with MM_LOMETRIC or
MM_LOENGLISH.

I wrote a CAD plotting engine with print preview using 100% GDI calls,
because I don't trust Delphi's Canvas implementation. I used
DrawText() with the option that calculates the text rectangle and
had no problems whatsoever ...

Look up the SetMapMode() and DrawText() functions in Windows API Help.

Good Luck
Peter

Other Threads