PrintPreview and scaling fonts

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

PrintPreview and scaling fonts

Postby rmaster » June 16th, 2014, 2:23 pm

Hello,

sorry about my English. I have used TPrintPreview component for years and it is absolutely perfect.
I have small problem with windows 7,8 font scaling (120%, 150%,.....).

My application displays special formated text from RichEdit to PrintPreview.
Canvas Width, Height, Margins I have in PageDialog.

Code: Select all
PrintPreview1.BeginDoc;
PrintPreview1.PaintRichText(PageDialog, RichEdit1, 1, nil);
PrintPreview1.EndDoc;


Everything works fine but if user sets windows scaling for example 150% - font are smaller in comparison with forms and my special text is wrong.
Is there some possibility how to adjust PrintPreview depending on the font scaling?

I used your DEMO (General Demo) and you can see the different in attachment - 100% and 150%.
Thank you for help.
RM.
Attachments
100.jpg
100%
100.jpg (129.03 KiB) Viewed 670 times
150.jpg
150%
150.jpg (121.91 KiB) Viewed 670 times
rmaster
Member
Member
 
Posts: 3
Joined: August 30th, 2009, 10:19 am

Re: PrintPreview and scaling fonts

Postby anlulegi » July 7th, 2014, 8:16 am

I have the same problem when value of PPI is greater than 96:
I have enabled next on my Project Source code :


Code: Select all
type
  TScreenHelper = class helper for TScreen
  public
    procedure SetPixelsPerInch(Value: integer);
  end;

 TScreenEx = class(TScreen)
  published
    property PixelsPerInch;
  end;


and, before Application.Formcreate(...) i call:

Code: Select all
Screen.SetPixelsPerInch(ppi); // Ppi can be 96, 120, 144. readed from ini file.


I have tryed with Scalecanvas function changing:

Code: Select all
SetViewPortExtEx(ACanvas.Handle, DevExt.X, DevExt.Y, nil)

to
Code: Select all
SetViewPortExtEx(ACanvas.Handle, muldiv(DevExt.X,ppi, 96), muldif(DevExt.Y, ppi, 96), nil);


At Screen it go fine but not in printer.canvas. If you don't change anything in Scalecanvas, at printer go fine but not in screen.
anlulegi
Member
Member
 
Posts: 1
Joined: July 7th, 2014, 7:58 am


Return to DELPHI AREA Products

Who is online

Users browsing this forum: No registered users and 2 guests

cron