On Wed, 6 Sep 2023 18:47:48 +0200 Fulvio Senore wrote:
FS> > FS> After the upgrade to 3.2.2.1, under Windows (I don't know for other
FS> > FS> platforms), if the screen text size is set to more that 100%,
FS> >
FS> > Do you mean the screen DPI or the separate text magnification option?
FS>
FS> The screen magnification option: right click the desktop, then select
FS> "screen settings" or something similar (my Windows copy is in Italian).
It's called "Display settings" in English, but I just wanted to make sure
we were speaking of "Change the size of text, apps and other items"
combobox there, with the values ranging from 100% to 350% in it because I
believe there is some other setting in Windows 11 which scales the text
only.
FS> It took me some time but I was able to solve the problem.
FS>
FS> In the printout, when doing scale computations, the sample uses
FS>
FS> GetPPIScreen(&ppiScreenX, &ppiScreenY);
FS>
FS> while I used
FS>
FS> wxScreenDC sdc;
FS> ppiScreenX = sdc.GetPPI().GetWidth();
FS> ppiScreenY = sdc.GetPPI().GetHeight();
FS>
FS> For some reason my code returned a higher PPI value when magnification
FS> is on, leading to smaller text.
Well, if you use higher DPI for your screen, it's expected that wxScreenDC
returns a higher value, so I don't see any problem here.
FS> I still would like to know why wxPrintout::GetPPIScreen() and
FS> wxScreenDC::GetPPI() return different values.
FS>
FS> In my Windows computer now wxPrintout::GetPPIScreen() always return 96.
This was changed in 1a1d19e93b (Improve print preview and printing with
high DPI, 2022-04-20) which was part of 3.1.7 and it looks like it
compensated for the problems previously introduced into this code when
adding high DPI support.
I'm not sure if returning the standard DPI, as wxPrintout::GetPPIScreen()
does by default, is the right thing to do, but it looks like all its code
assumes that this is the case and we'd need to change a lot of things if we
changed this. To be honest, it's not clear at all why should wxPrintout
care about the screen DPI: after all, what's printed shouldn't depend on
whether you print it on a computer with a normal or high DPI monitor (and
what if you have both of them connected to the same computer, as I do right
now?). So I think that perhaps we should explain in the documentation that
wxPrintout "screen PPI" is not really screen PPI at all... And maybe we
should provide GetPrinterScaleFactor() or something like this to make it
unnecessary to use GetPPIScreen(), and GetPPIPrinter(), explicitly.