Window.ScaleFactor, Mac vs. Windows

I’m updating an app to work with HiDPI and I’m finding differences between the way Mac Retina and Windows HiDPI behave.

Actually it could be that they behave exactly the same, but the ScaleFactor is comprised of different elements per platform…

I’m trying to figure this out because the LR supplies no details on Window.ScaleFactor or Screen().ScaleFactor other than it has to do with HiDPI.

Here’s what I think might be right, please correct it if I’m wrong…

In addition to HiDPI / Retina or non-HiDPI / non-Retina, the ScaleFactor is calculated by another variable on each platform:

  1. On Mac, the second variable is the Screen Resolution as selected in System Preferences > Displays > Display, which since OSX 10.10 (I think) shows a set of options for changing the text size on any given monitor, but there are no numbers given for this, only a set of vague icons ranging from “larger text” to “more space”. It’s unclear if this setting affects only text or changes the whole monitor resolution – it clearly says there “Resolution” – I don’t want to muck up my multi-monitor layout here messing around with these settings, so I wonder if anyone can explain this ?

  2. On Windows, the second variable is “Change the size of text in apps, and other items” under Settings > System > Display … Scale and Layout, which shows a percentage number, and it seems Windows 10 defaults to a setting of 150% here if the display is HiDPI (I guess this may be set differently per screen size?)

Is this correct? Though the two options per platform look similar, it seems they do not actually behave at all the same. In any case I think such information should be in the LR. I ran into some very weird drawing behaviour on Windows because I did not know about the percentage Scale affecting the value of ScaleFactor. I’ve fixed it by multiplying values by the ScaleFactor, but sometimes I had to multiply twice to get it to look right, so it’s not exactly logical to me yet (I don’t quite understand why my “fix” works).

[quote=451554:@Aaron Hunt]On Mac, it’s Screen Resolution as selected in System Preferences > Displays > Display, which since OSX 10.10 (I think) shows a set of options for changing the text size on any given monitor, but there are no numbers given for this, only a set of vague icons ranging from “larger text” to “more space”.

[/quote]
Keep in mind that if you hold the Option key when switching modes, macOS will show you the screen resolutions instead of larger/smaller.

FWIW, you shouldn’t need to be concerned with anything except ScaleFactor in your app… and then maybe not even that. Graphics are now drawn using Points instead of raw pixels, but the underlying coordinate system should not have changed between having hidpi off and having it on.

The only time this should matter for an average user is in dealing with pictures. For HiDPI apps, you should be converting pictures to Images and supplying three copies with the original size, 2x and 3x the original. For instance if the original were 60x30, the second and third would be 120x60 and 180x90 respectively.

I know it should, but on my system it doesn’t, I don’t know why (maybe because it’s a MacBook with 2 screen outputs working from both mini-DVI and HDMI).

Are you saying that the text-size icons on Mac are aliases for actually changing a screen resolution setting? That would be different from what the Windows percentage text size setting is doing, right? Or is it the same?

Yes[quote=451557:@Aaron Hunt]That would be different from what the Windows percentage text size setting is doing, right? Or is it the same?[/quote]
Technically it’s the same. The tricky part is that on Windows, fractional scale factors are supported.

Apple’s take was that there are Retina and non-Retina displays. Scale factors are 1.0 or 2.0.

Microsoft thinks of scale factor in terms of how much bigger you want things to be on screen with the default setting getting you as close as possible to 96ppi as possible. This means that if the default in your system is 150%, the scale factor will be 1.5. They are in 25% increments.

Thank you, Greg!

I think it would be useful to add that information to the LR and link to it from the following pages:

Screen.ScaleFactor
Window.ScaleFactor
Canvas.ScaleFactorChanged
Window.ScaleFactorChanged

Thanks for all that info, Greg! Windows has an “advanced” option that allows the user to type in any number they want between 100 and 500. Does Xojo report these exactly or does it round to the nearest 25%? Would 137% appear in Xojo as 1.37?

It does
I used to have mine set at 169 just for testing