Forum moved here!

Home / Make CustomScreenDPI accept float value

Fubaxiusz

Currently the CustomScreenDPI = 93.663 setting in Advanced Settings rounds the number down to 93.
Is is possible to make it accept decimal values?
Thanks

GitHubRulesOK

Relative screen resolution is a nominal value, In windows it is normally a notional default of 96 whole pixels per inch (DPI=initially no such concept as sub-pixels)
When I set an appropriate value of of 90 for my left screen it would need to be 130 for the same scalar amount on my right screen.

It was normal to store such settings as whole numbers hence in the code it is one integer value for the “main” screen, its up to you to decide which of many is the main one.

Mathmatically the “granularity” of 96+/-1 is approx 1 in 100 (e.g steps of 0.01" for most users) so approx a coarse hairs width per edge and the integer math should be generally translated in steps of 1.041667 pixels ! so can never be true even if we were to use “real” values

Fubaxiusz

The philosophy behind integer numbers is legit, I understand.
My intend was to get 1:1 page size on monitor to the real A4 paper.
As you can see, now when I set DPI to 94 the page width is slightly off.


I calculated the appropriate number using Windows build-in 3 inch ruler in the DPI settings panel.
I know it’s kind of OCD :upside_down_face: but, still it would be nice being able to fix that

Fubaxiusz

PS:
Interestingly another not-related software (Affinity Designer) renders pages at 1:1 size at 100% zoom, even when system settings are off (default 96 DPI, while accurate number is 93.663) :thinking:
I assume that it gets the DPI info from somewhere… maybe device info… Maybe same automatic PPI system could be added to Sumatra :bulb: idea

Fubaxiusz

I found out, that the monitor physical properties, like dimension in cm, can be accessed through EDID (Extended Display Identification Data), that are stored inside registry. (HKLM\SYSTEM\ControlSet001\Enum\DISPLAY)
http://www.nirsoft.net/utils/dump_edid.html
https://docs.microsoft.com/en-us/previous-versions//ms775210(v=vs.85)

Maybe that will help Sumatra scale pages correctly.
Please let me know if you make any update.

GitHubRulesOK

Interesting I tried your suggested utility to see what the system reported for my screens.
as I suspected from past experience they are nothing like the reported values one is undersized by 1.063x & 1.029y the other is 0.708x and 0.714y hence the historic need for every user to set their own preference based on hardware.

what did suprise me is that SumatraPDF seems to apply a reverse logic since my calculations suggested increasing from a default 96dpi to achive a better 102.05 working value but in reality i needed to decrease to between 89 and 90 !!

I also agree that since if a screen is 12" (or now more frequently up to 50" :slight_smile: that one dot per inch results in a totaly large step difference. Thus I would suggest that the current math abandon using 96 as a median and simply use an undivided arbitary unit with say 10,000 as default integer width thus able to distinguish +/- a nominal 0.001 inch for a nominal 10" wide screen

SumatraPeter

Seems to work fine on all the screens I checked! What specific monitor models do you have, and what are their reported values, if I may ask?

GitHubRulesOK

This is todays pair of screens (external and laptop) working values are rounded but I considered them as close enough for comparison

[Later edit]
See more accurate valuesin later post

reported size 41 X 26 cm (19.1 Inch)
Maximum Resolution : 1440 X 900 (correct as current mode)
actual working area 40.5 x 24.5 cm [My bad this should have been 25.5]
nominally @ 96dpi 15 x 9.375 inches
converted to cm = 38.1 x 23.8125
thus undersize compared to phyical by 1.063x & 1.029y
trying 102.05 as a correction did not work 89 is too small 90 a tad too big

laptop
reported 27 X 16 cm (12.4 Inch)
Maximum Resolution : 1366 X 768 (correct as current mode)
actual working area 25.5 x 14.5 cm
nominally @ 96 dpi=14.2 x 8 inches
converted to cm 36 x 20.32
thus oversized compared to physical by 0.708x & 0.714y

Thus neither of my current screens is maintaining a commom fixed ratio (not a problem for reading but would need OSD menu corrections/adjustment for CAD or graphics “squareness”)

SumatraPeter

Have you changed the scaling level on either system? I wonder what the monitor PPI is for both models as per the manufacturers…

GitHubRulesOK

Peter in my case I resist upscaling (or is that down ?) as you know SumatraPDF works best at 100% (same as most other apps)
I have revisited the readings with more precission.

Hp LE1901w (internal Samsung - LTM190BT03)
Square Pixel Size ratio 0.2835mm x 0.2835mm

This equates to 89.59435626102293 DPI
Which is what I previously found by trial and error

So In my case the nearest whole value is 90
a small 0.2835mm diference when multiplied by 15 inches becomes more than 4 mm difference, for some users it can be worse

As far as I can tell the folowing spec holds true
WSXGA, 1440 x 900 Pixels (16:10)
Active Area: 408.24mm x 255.15mm

Unfortunatly the software reports that there is a
Maximum Image Size : 41 X 26 cm (19.1 Inch)
Whilst approx true in this case (but NOT for the laptop screen) it
was less use than checking the manufacturers spec

SumatraPeter

Could be a rounding error in some cases I suppose, although according to reports some manufacturers are downright lazy or careless and don’t set the EDID info properly.