linebender / linebender/druid

Rounding to pixel grid is not dpi aware

Open
#1,132 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

architecture D-Medium discussion
Dominant language
Rust
Stars
9.7k
Forks
565
PR merge metrics
No merged PRs in 30d

Description

#734 rounds sizes to integer number of px, but this is not the correct behavior when the dpi scaling factor is not 1.0.

Fixing this is not trivial. To know the dpi requires context, and this is a value that can change dynamically.

#1037 brings up much deeper architectural concerns. I chose px rather than device pixels as the units for layout because it's meaningful from a design perspective, and because it minimizes the chance of user layouts changing unintentionally with dpi, but it might be worth reconsidering this choice. There are a number of computations, of which this is one, and layout of windows in a virtual desktop (on Windows; mac is probably more geared to "points" than device pixels) is another, for which device pixels are probably a more natural unit of computation. Maybe we should consider using device pixels for layout, and do conversions as appropriate.

Or maybe we should keep px, but have mechanisms to round to device pixels using context.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reading the behavior described in #734 and the architectural concerns in #1037, then locate the layout computations that round pixel sizes. The issue does not name files or tests; done would require an agreed approach for dpi-aware rounding or a decision to use device pixels, followed by validation of dynamically changing dpi context.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
desktop
Issue type
Bug
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.