Skip to content

Conversation

@ShahzaibIbrahim
Copy link
Contributor

Having the scale factor being based on the screen DPI leads to unexpected result e.g. Image too big/small. Having a screen dpi independent factor leads to consistent results.

@ShahzaibIbrahim ShahzaibIbrahim changed the title [Cocoa] Replaceing usages of Display#getDPI from cocoa [Cocoa] Replacing usages of Display#getDPI from cocoa Dec 10, 2025
@ShahzaibIbrahim ShahzaibIbrahim linked an issue Dec 10, 2025 that may be closed by this pull request
1 task
@github-actions
Copy link
Contributor

Test Results (macos)

   54 files  ±0     54 suites  ±0   19m 5s ⏱️ + 8m 18s
4 512 tests ±0  4 269 ✅ ±0  243 💤 ±0  0 ❌ ±0 
  104 runs  ±0    104 ✅ ±0    0 💤 ±0  0 ❌ ±0 

Results for commit 9dd729d. ± Comparison against base commit 833d748.

Copy link
Contributor

@HeikoKlare HeikoKlare left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Having the scale factor being based on the screen DPI leads to unexpected result e.g. Image too big/small. Having a screen dpi independent factor leads to consistent results.

Can you share an example where one can see such unexpected results?

And can you explain how this change relates to the commit/PR title of replacing usages of Display#getDPI()? This rather seems to be about replacing usages of Display#getScreenDPI(), as there are still usages of Display#getDPI() that are not replaced, in particular the one in Device#init(), which assigns the value to Device#dpi that is accessed by Font afterwards:
image

I think it would help to first collect information about the contract of Device#getScreenDPI() and Device#getDPI(), i.e., on what exactly the values depend, so that we can understand how they can be properly used. Maybe there is even something obsolete in those methods.

Having the scale factor being based on the screen DPI leads to
unexpected result e.g. Image too big/small. Having a screen dpi
independent factor leads to consistent results.
@ShahzaibIbrahim
Copy link
Contributor Author

Just like in GTK, we have now only two remaining usages for getDPI in cocoa which we cannot be logically replaced.
image

For later: we can deprecate the getDPI method now, but later we can keep the usage to internal by making getDPI package protected.

Currently this PR doesn't add anything to the deprecation of getDPI(). Hence closing it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants