question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

API request: text / UI scale factor (DPI / UI user-preferences for scaling)

See original GitHub issue

Many Android devices have different DPI, and on top of this, in later Android versions (at least 7+) it is possible to change the size of text elements in all apps.

However, when not using the Android toolkit but e.g. SDL2 (which at least appears to not support the DPI querying for Android - unless I’m wrong), there is currently no obvious way to get a plain pixel scaler (e.g. 2.0x for a 144 DPI 4K screen with 1.0x custom UI scaling on top) which boils all this information down in a useful way.

Therefore, I propose to add an API to do the following:

  1. List all screens with all pixel dimensions or None if the API is not implemented for the given platform
  2. Get a incorporates-DPI-user-ui-scaling-and-everything scaler for each screen (should be float, not int!!), or None if not known

On Android, it would of course only list a single screen usually, but on desktop it is common to have multiple screens with different DPI, so if it’s ever implemented there this screen distinction is somewhat important.

Issue Analytics

  • State:open
  • Created 5 years ago
  • Comments:5 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
ghostcommented, Dec 11, 2018

Does it also include text scaling (Set custom text size (DPI) on Windows) the same way per monitor?

In Gnome 3 I don’t think so, and on Windows I don’t know - but as I said above, I would expect that eventually an OS might offer this in the future, so I think it’d be wise to assume it could be the case, even if no OS makes practical use of this.

Oh, ok, I didn’t know it’s allowed to have different DPI scaling per monitor

Windows and Linux didn’t support this for a long time (Linux still doesn’t unless you use the new Wayland I think), so yeah, many older applications just don’t handle this properly. But it’d be nice to be able to do so with plyer!

0reactions
KeyWeeUsrcommented, Dec 11, 2018

Oh, ok, I didn’t know it’s allowed to have different DPI scaling per monitor. In that case, sure, let’s keep it per the device itself. Does it also include text scaling (Set custom text size (DPI) on Windows) the same way per monitor?

image

Read more comments on GitHub >

github_iconTop Results From Across the Web

UI Scale/ Zoom Offset - Feature Requests - Platform and API
Feature Description: A changeable scale factor per window. The scaling based on the DPI works great and it would be nice to have...
Read more >
Detect scale settings (dpi) with JavaScript or CSS
Try accessing window.devicePixelRatio variable. The Window property devicePixelRatio returns the ratio of the resolution in physical pixels to the ...
Read more >
ui/display/win/dpi.h - chromium/src - Git at Google
Sets the device scale factor that will be used unless overridden on the ... the entire UI by a combination of text scale...
Read more >
High DPI | Qt 6.4 - Qt Documentation
The scale factor is expressed as a floating point number, for example 1.0 or 2.0 ... applies to most units in higher level...
Read more >
UI Font size of Davinci resolve - Blackmagic Forum • View topic
I am using the Studio version. DR 17.4 is useless now because of its newly implemented UI scaling issue. It is really disappointing....
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found