Page 1 of 1

PrintPreview and scaling fonts

PostPosted: June 16th, 2014, 2:23 pm
by rmaster
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.

Re: PrintPreview and scaling fonts

PostPosted: July 7th, 2014, 8:16 am
by anlulegi
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.