[Development] [HiDPI] Rethinking the scaling algorithm
Thiago Macieira
thiago.macieira at intel.com
Tue Nov 8 23:02:04 CET 2016
Em terça-feira, 8 de novembro de 2016, às 15:57:40 CST, Niccolò Belli
escreveu:
> 1) Always round down. With your current formula a 145ppi screen gets scaled
> by a 2x factor, while every other toolkit (GTK3 for example[3]) starts
> scaling at 192ppi. This is also what people expect and it would return the
> correct 2x scaling factor for my laptop. So the formula should be
> scaling_factor=qRoundDown(yourDpi/96)
Agreed we need to adjust the formula. I'm not sure a full round down (i.e., an
integer division) is what we want. Another option is
qRound(dpi / 96.0 - 0.75);
That would make:
DPI < 168 1x
DPI < 264 2x
etc.
> 2) Expose an environmental variable to allow people to choose which logical
> PPI they want to target. Such a variable should default to 96ppi. In fact
> some people might have poor eyesight or might desire a different viewing
> distance and thus they would like to target a different logical PPI. So the
> formula should be scaling_factor=qRoundDown(yourDpi/EnvVar)
We have plenty of environment variables already. I personally set
QT_SCREEN_SCALE_FACTORS to 2 on my 13" 3200x1800 display (font DPI is 216).
# 0 "eDP-1" Depth: 24 Primary: yes
Geometry: 1600x900+0+0 (native: 3200x1800+0+0) Available: 1600x876+0+0
Physical size: 294x165 mm Refresh: 59 Hz Power state: 0
Physical DPI: 138.231,138.545 Logical DPI: 108.085,108.341 (native:
216.17,216.682) Subpixel_None
High DPI scaling factor: 2 DevicePixelRatio: 2 Pixel density: 3
Primary orientation: 2 Orientation: 2 Native orientation: 0
OrientationUpdateMask: 0
--
Thiago Macieira - thiago.macieira (AT) intel.com
Software Architect - Intel Open Source Technology Center
More information about the Development
mailing list