[Development] [HiDPI] Rethinking the scaling algorithm

Niccolò Belli darkbasic at linuxsystems.it
Wed Nov 9 19:40:14 CET 2016


On martedì 8 novembre 2016 23:02:04 CET, Thiago Macieira wrote:
> 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.

I suggested a full round down because it mimics the behaviour of GTK3, 
which seems to work pretty well for them: 
https://wiki.gnome.org/HowDoI/HiDpi
Anyway anythink else will probably work better than the current 
implementation which is simply broken and must be changed ASAP.


> 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

AFAIK QT_SCREEN_SCALE_FACTORS doesn't scale fonts, so you will still have 
to rely on QT_SCALE_FACTOR, which forces you to change the variable every 
time that you switch to another monitor.



More information about the Development mailing list