High DPI issues

Teo Mrnjavac teo at kde.org
Tue May 20 12:28:31 UTC 2014


On Monday, May 19, 2014 15:07:24 David Edmundson wrote:
> On Mon, May 19, 2014 at 2:48 PM, Teo Mrnjavac <teo at kde.org> wrote:
> > On Monday, May 19, 2014 14:40:59 David Edmundson wrote:
> >> Read this before doing anything:
> >> http://blog.qt.digia.com/blog/2013/04/25/retina-display-support-for-mac-o
> >> s-i os-and-x11/
> >> 
> >> There are branches being merged in for 5.4. They affect QWidgets too.
> >> 
> >> Everything is based around a devicePixelRatio.
> >> As I understand it, you write code as though you have pixels on a
> >> normal 96dpi screen; but then there's a scaling factor for high DPI
> >> skills which converts to screen pixels.
> >> 
> >> This can be overridden by an env variable.
> >> 
> >> It's always better to work closer with upstream than to roll your own
> >> thing. _______________________________________________
> >> Plasma-devel mailing list
> >> Plasma-devel at kde.org
> >> https://mail.kde.org/mailman/listinfo/plasma-devel
> > 
> > Working with upstream would of course be best. Could you please point me
> > to
> > those branches? The blog post you linked is quite old now.
> > It still won't be easy to compute a good scaling ratio, but heuristics in
> > Qt or a QPA > our own thing.
> 
> For most platforms it's merged together
> See http://qt-project.org/doc/qt-5/qwindow.html#devicePixelRatio
> 
> and the base class for the QPA.
> qtbase/src/gui/kernel/qplatformscreen.cpp devicePixelRatio
> 
> It seems the X Platform backend doesn't implement it yet. Probably for
> the reasons you've talked about already. I don't know where any
> patches on that are. I could search for it, but you can Google as well
> as me.
> 
> David

Hello,

I've had a chat with Morten Johan Sørvig, the person behind the high DPI 
effort in Qt. What follows is a status report.

The work on high DPI support that's already merged is focused on OS X and iOS, 
but it's mostly cross-platform code. There's also some unmerged work on other 
platforms.
The X11 implementation of the scaling feature would rely on an environment 
variable QT_HIGHDPI_SCALE_FACTOR, leaving it to the workspace to set this 
value to something sensible (also described in [1]). The current unmerged 
state of things on X11 is available on his GitHub [2]. Overall it seems in 
good shape but there's still some kerning issues and quirks.

According to Morten, "if there is interest, 5.4 is a possible target".
He also made some screenshots of KF5 based Kate running on his branch of Qt 
[3].

>From our end, all we'd need to do is figure out some smart way to produce a 
QT_HIGHDPI_SCALE_FACTOR when starting a Plasma session, and possibly have the 
value change based on the fonts DPI override in the Fonts KCM.

Another important issue is that currently the only tested and nicely working 
values for QT_HIGHDPI_SCALE_FACTOR are 1.0 and 2.0, i.e. Mac OS style scaling. 
Since we don't control the hardware end of things we can't afford that, and 
I've made it clear we'd need some more fine grained control of the scale 
factor. According to Morten, it is not possible to pick just any scale factor 
and expect good results. I'm hoping that scale factor increments of .25 could 
produce decent results and minimize glitches, but the only way to be sure of 
that is trying it out. I'll try to give his branch a spin when I get the 
chance.

I'll be following this as it unfolds, and I expect there's a good chance this 
might land in 5.4.


[1] https://blog.qt.digia.com/blog/2013/04/25/retina-display-support-for-mac-os-ios-and-x11/
[2] https://github.com/msorvig/qt5-qtbase-highdpi
[3] https://imgur.com/a/JhXSX


Cheers,
-- 
Teo Mrnjavac
http://teom.org | teo at kde.org


More information about the Plasma-devel mailing list