HiDPI support

Asked by Sherif on 2017-08-16

I am using qpdfview on Archlinux running on Dell XPS13 9343. Unfortunately the menu sizes are very tiny that I hardly able to read anything. Is there HiDPI support in qpdfview. Is there any command line options to enable that?

Question information

Language:
English Edit question
Status:
Solved
For:
qpdfview Edit question
Assignee:
No assignee Edit question
Solved by:
Adam Reichold
Solved:
2017-08-16
Last query:
2017-08-16
Last reply:
2017-08-16
Best Adam Reichold (adamreichold) said : #1

Hello Sherif,

qpdfview's rendering of documents should be device-pixel-ratio-aware, i.e. the pages and their content should be scaled correclty, in recent versions. For the UI itself, you may need to convince Qt to adjust their sizes, e.g. by setting the environment variable QT_AUTO_SCREEN_SCALE_FACTOR=1 when running the application. Please compare https://doc.qt.io/qt-5/highdpi.html for the full list of settings that one can adjust.

Best regards, Adam.

Sherif (silentquote) said : #2

Hi Adam,

Thanks for the hint. QT_AUTO_SCREEN_SCALE_FACTOR=1 did not solve my problem. I manually picked the scaling factor using QT_SCALE_FACTOR=2 and it looks great now. :)

Bo Simonsen (bo) said : #4

I run with

QT_FONT_DPI=96
QT_SCALE_FACTOR=1.5

and PDF's are blurry, if I go bac kto QT_SCALE_FACTOR=1 everything is crystal clear. Should be easily verifiable.

I run with Debian buster, their version 0.4.17~beta1+git20180709-2.

Bo Simonsen (bo) said : #5

Forgot, also with QT_SCALE_FACTOR=2 pdf's are blurry.

Okular suffered from the same, I believe the fix is this:

https://phabricator.kde.org/R223:ecc1141e0293e1a30e0f8787d86dcc6309ffb0c0

Adam Reichold (adamreichold) said : #6

Hello Bo,

please make sure that you enabled "Use device pixel ratio" on "Graphics" resp. "General" tabs of the settings dialog. If that does not improve the situation, please open a bug report and attach screenshots with and without that setting enabled. Thanks!

Regards,
Adam

Bo Simonsen (bo) said : #7

Hi Adam.

Thanks for getting back. It did not help, it should be easy verifiable just run
$ QT_SCALE_FACTOR=1.5 QT_FONT_DPI=96 qpdfview

Could you verify that you alsso see blurry text?

Bo

Adam Reichold (adamreichold) said : #8

> Could you verify that you alsso see blurry text?

I get blurry text for QT_SCALE_FACTOR=1.5 but not for QT_SCALE_FACTOR=2, so qpdfview does not support fractional scaling properly. Sounds like a good start for a bug report...

My guess is we need to use devicePixelRatioF instead of devicePixelRatio when querying the widgets device pixel ratio in various places but I am not sure if/when someone will find the time to make that change.)

Bo Simonsen (bo) said : #9

QT_SCALE_FACTOR=2 works fine here also.

I think you are right, pretty much what the Okular patch I mentioned earlier does. I will give it a shot pretty soon,
if it works out I will submit a patch.

Bo

Adam Reichold (adamreichold) said : #10

You can also give trunk revision 2091 a try as it seems to be limited to three places where we query that number...

(Also note that the Okular patch linked above is about adding usage of devicePixelRatio in the first place. qpdfview has the functionality as well, but we added it when the QPaintDevice::devicePixelRatioF API did not yet exist.)

Bo Simonsen (bo) said : #11

So cool, it fixed it! Thanks a lot!