TPrintPreview and fonts issue

Please post bug reports, feature requests, or any question regarding the DELPHI AREA projects here.

TPrintPreview and fonts issue

Postby Matija » October 25th, 2011, 10:29 am

Until now, I always used TPrintPreview with defining font size simply using its Canvas.Font.Size property.
However, in current project I have to be quite exact and had to define font height in milimeters.

I do it using Canvas.Font.Height:=round(X*MM.X), where X is required size in mm's and MM.X my pixels to milimeters conversion TPoint, obtained by:

Code: Select all
PPP.Units:=mmHiMetric;
     ...
MM:=PPP.ConvertXY(10,10,mmLoMetric,mmHiMetric);


It works fine, all the dimensions are ok, BUT:
- when I use DirectPrint it prints exactly as it should
- when I don't use DirectPrint, and instead I use my preview form with printer settings and page print controls, all the fonts are printed (both on screen and printer) somehow stretched (readable, but it is obvious that something is wrong with distance between letters...)

I attached an image of this cases.
When using Canvas.Font.Height:=-round(X*MM.X), things get better, but all heights are little higher than expected, so I have to recalculate and fix all height settings in my code to get proper result.

Any suggestions how to make it work properly (getting the same display/print without DirectPrint as I get print with DirectPrint)?

differences-TPrintPreview.gif
sample of all three cases - I want to obtain first one (with DirectPrint) without using DirectPrint 8-)
differences-TPrintPreview.gif (18.62 KiB) Viewed 1726 times
Matija
Member
Member
 
Posts: 4
Joined: May 18th, 2005, 10:12 am

Return to DELPHI AREA Projects

Who is online

Users browsing this forum: No registered users and 2 guests

cron