HiDPI aware and font scaling (MSW)
-
- Earned some good credits
- Posts: 119
- Joined: Wed May 19, 2021 11:17 pm
- Contact:
HiDPI aware and font scaling (MSW)
On MSW,
VS 2022, Windows 11, wx 3.1.6
if I set my manifest to HiDPI aware,
wxSystemSettings::GetMetric(wxSYS_SCREEN_X) etc returns the full resolution screen size.
Under this manifest setting, if I use a font in wxDC to draw text,
the font gets scaled by wxWidgets or Windows I assume.
If I don't set HiDPI aware,
wxSystemSettings::GetMetric(wxSYS_SCREEN_X) etc returns a lower resolution screen size.
I assume wx or Windows scales the entire app's window in this case.
Is is possible to have the app at full resolution and not have automatic font scaling?
Perhaps I'm missing some setting somewhere?
VS 2022, Windows 11, wx 3.1.6
if I set my manifest to HiDPI aware,
wxSystemSettings::GetMetric(wxSYS_SCREEN_X) etc returns the full resolution screen size.
Under this manifest setting, if I use a font in wxDC to draw text,
the font gets scaled by wxWidgets or Windows I assume.
If I don't set HiDPI aware,
wxSystemSettings::GetMetric(wxSYS_SCREEN_X) etc returns a lower resolution screen size.
I assume wx or Windows scales the entire app's window in this case.
Is is possible to have the app at full resolution and not have automatic font scaling?
Perhaps I'm missing some setting somewhere?
Re: HiDPI aware and font scaling (MSW)
Windows does it, yes.Rohit Agarwal wrote: ↑Thu May 12, 2022 4:15 am I assume wx or Windows scales the entire app's window in this case.
What exactly is the issue? Font sizes can be set in pixels and points (which is dpi independent), and i would expect wxDC to obey these values (but i haven't tested it myself).Rohit Agarwal wrote: ↑Thu May 12, 2022 4:15 amIs is possible to have the app at full resolution and not have automatic font scaling?
Use the source, Luke!
-
- Earned some good credits
- Posts: 119
- Joined: Wed May 19, 2021 11:17 pm
- Contact:
Re: HiDPI aware and font scaling (MSW)
This is not a show-stopper for me.doublemax wrote: ↑Thu May 12, 2022 6:28 amWindows does it, yes.Rohit Agarwal wrote: ↑Thu May 12, 2022 4:15 am I assume wx or Windows scales the entire app's window in this case.
What exactly is the issue? Font sizes can be set in pixels and points (which is dpi independent), and i would expect wxDC to obey these values (but i haven't tested it myself).Rohit Agarwal wrote: ↑Thu May 12, 2022 4:15 amIs is possible to have the app at full resolution and not have automatic font scaling?
When I use the HiDPI aware manifest,
I observe that whatever font size I set (using wxFontInfo( double pointSize )),
the displayed font appears to be a scaled version of the requested font
(possibly, to account for the HiDPI of the monitor?).
i.e. If I don't use HiDPI aware and set a font size
and I use HiDPI aware and set the same font size, the results are not different.
On a high res monitor, if I set HiDPI aware, I would have expected to use a much larger font size
to account for the increase in resolution.
But it appears that wx or windows is scaling the font size I dial in in the HiDPI aware setting
which I was not expecting it to do.
Re: HiDPI aware and font scaling (MSW)
The behavior is expected, because the "point" size used for fonts is not in pixels, it has a unit of 1/72th inch, which means it's resolution independent. I.e. if the font size is 18 point, it should have a visible size of 0.635mm no matter on which device.
Use the source, Luke!
-
- Earned some good credits
- Posts: 119
- Joined: Wed May 19, 2021 11:17 pm
- Contact:
Re: HiDPI aware and font scaling (MSW)
OK. Got it. Thanks!
-
- Earned some good credits
- Posts: 119
- Joined: Wed May 19, 2021 11:17 pm
- Contact:
Re: HiDPI aware and font scaling (MSW)
FWIW,
While MSW and Linux display the requested (points-based) resolution independent sizes,
OSX for some reason displays a much smaller size.
This is likely a WXOSX implementation issue.
While MSW and Linux display the requested (points-based) resolution independent sizes,
OSX for some reason displays a much smaller size.
This is likely a WXOSX implementation issue.
Re: HiDPI aware and font scaling (MSW)
Hi,
Can you try the non-wx application? TextEdit for example?
Thank you.
Can you try the non-wx application? TextEdit for example?
Thank you.
-
- Earned some good credits
- Posts: 119
- Joined: Wed May 19, 2021 11:17 pm
- Contact:
Re: HiDPI aware and font scaling (MSW)
I ran TextEdit and looked at font size adjustments.
It does not say whether those sizes are in points or not.
But a setting of 12, which is the point-size(12.0) I'm using in my wx app
gives about the same size font as my wx app does on OSX.
It's a lot smaller than a 12.0 font on MSW or Linux.
A TextEdit font size setting of 18 gives roughly the same size
as a 12.0 font on MSW or Linux.
It does not say whether those sizes are in points or not.
But a setting of 12, which is the point-size(12.0) I'm using in my wx app
gives about the same size font as my wx app does on OSX.
It's a lot smaller than a 12.0 font on MSW or Linux.
A TextEdit font size setting of 18 gives roughly the same size
as a 12.0 font on MSW or Linux.
Re: HiDPI aware and font scaling (MSW)
Are you testing on a real Mac or in a VM?
Use the source, Luke!
-
- Earned some good credits
- Posts: 119
- Joined: Wed May 19, 2021 11:17 pm
- Contact:
Re: HiDPI aware and font scaling (MSW)
MacMini with 20" 1600x900 HP Monitor
Display Resolution set as Default for display.
wxSystemSettings::GetMetrics returns 1600 x 900 for the screen size
Display Resolution set as Default for display.
wxSystemSettings::GetMetrics returns 1600 x 900 for the screen size
Re: HiDPI aware and font scaling (MSW)
The question is whether the OS knows the PPI of the screen. Can you see that anywhere in OSX?Rohit Agarwal wrote: ↑Fri May 20, 2022 3:58 pm MacMini with 20" 1600x900 HP Monitor
Display Resolution set as Default for display.
wxSystemSettings::GetMetrics returns 1600 x 900 for the screen size
Use the source, Luke!
-
- Earned some good credits
- Posts: 119
- Joined: Wed May 19, 2021 11:17 pm
- Contact:
Re: HiDPI aware and font scaling (MSW)
I'm guessing OSX does not know the PPI of the screen.
The only clue it has is the name of the monitor (HP 20wd),
from which it infers the default resolution.
It's connected via a DisplayPort to DVI connector.
Perhaps the protocol (in this case DVI) tells it the screen size
though I doubt that.
The PPI in this case is pretty low (~100).
So if the OS does not know and is using a default setting
it will likely assume the lowest PPI setting.
Still points to a wxMAC implementation issue.
The only clue it has is the name of the monitor (HP 20wd),
from which it infers the default resolution.
It's connected via a DisplayPort to DVI connector.
Perhaps the protocol (in this case DVI) tells it the screen size
though I doubt that.
The PPI in this case is pretty low (~100).
So if the OS does not know and is using a default setting
it will likely assume the lowest PPI setting.
Still points to a wxMAC implementation issue.
Re: HiDPI aware and font scaling (MSW)
Hi,
You should test on the actual Mac machine with Retina display.
I don't know if Mac can get this from external monitors...
Thank you.
You should test on the actual Mac machine with Retina display.
I don't know if Mac can get this from external monitors...
Thank you.