[win32] Resolve tab stops entirely in points in TextLayout.computeRuns() - #3495
Merged
vogella merged 1 commit intoOct 2, 2026
Merged
Conversation
Contributor
vogella
force-pushed
the
textlayout-tab-stops-cleanup
branch
from
September 30, 2026 13:03
2cae3e0 to
2711be1
Compare
vogella
marked this pull request as ready for review
September 30, 2026 13:03
vogella
force-pushed
the
textlayout-tab-stops-cleanup
branch
2 times, most recently
from
September 30, 2026 16:14
5670f9b to
e0956a9
Compare
Since the fix for collapsed tab stops, the stop is selected in points, but the adjustment for merged consecutive tabs still sums pixel-converted stop widths. Past the last stop each extra tab adds the rounding error of the last tab width again, so positions drift away from the stops the caller defined. Keep the whole computation in points and convert once, when the final position is known. The exact space grid used for setDefaultTabWidth() stays in pixels. The degenerate case of a non-increasing tabs array now leaves the run at its measured glyph advance rather than adding a non-positive stop delta. Assisted-by: multiple AI agents and layers of automated tooling 🤖
vogella
force-pushed
the
textlayout-tab-stops-cleanup
branch
from
September 30, 2026 16:14
e0956a9 to
e59aa0a
Compare
There was a problem hiding this comment.
Copilot review overview
🟢 Approval recommended
The unit-consistent implementation is correct and covered by focused regression tests.
Review effort: Balanced
Findings: None
What changed in this PR
Keeps Win32 merged-tab calculations in points until final pixel conversion, eliminating HiDPI rounding drift.
Changes:
- Resolves custom tab stops consistently in point units.
- Adds multi-zoom regression coverage for merged tabs.
| File | Description |
|---|---|
TextLayout.java |
Corrects merged-tab stop positioning. |
TextLayoutWin32Tests.java |
Tests repeated stops across zoom levels. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The tab stop handling in
TextLayout.computeRuns()mixes units: the stop is selected in points while the resulting position and the adjustment for merged consecutive tabs are accumulated from the pixel-converted stops. This keeps the whole computation in points and converts once, when the final position is known, so the pixel copy of the stops disappears and the merged-tab adjustment works on the same values as the lookup.Besides being easier to follow, it removes a rounding drift: each step past the last tab stop currently rounds separately, so merged tabs can end a pixel away from the stop the caller defined. For example, three tabs with
setTabs(new int[] {10})end at 39 px instead of 38 px at 125% zoom.