Skip to content

[win32] Fix collapsed tab stops at fractional zoom levels - #3493

Open
vogella wants to merge 1 commit into
eclipse-platform:masterfrom
vogella:styledtext-tab-stops
Open

[win32] Fix collapsed tab stops at fractional zoom levels#3493
vogella wants to merge 1 commit into
eclipse-platform:masterfrom
vogella:styledtext-tab-stops

Conversation

@vogella

@vogella vogella commented Aug 8, 2026

Copy link
Copy Markdown
Contributor

TextLayout.setTabs() takes the tab stops in points, but computeRuns() converted them to pixels and compared them against a pen position accumulated from raw glyph advances. At zoom levels that are not a multiple of 100 that point/pixel round trip can place a stop one pixel past a pen position that actually sits exactly on that stop, so the tab advanced by a single pixel instead of moving on to the next stop.

StyledText runs straight into this because it measures its tab width as the width of N spaces in points and hands that back as the only tab stop, so a tab following N spaces lands precisely on the stop. That is the "tabs are sometimes not indenting" report in eclipse-platform/eclipse.platform.ui#3052. It surfaced in 4.36 when monitor-specific scaling turned the effective auto-scale from "integer" into "quarter", exposing zoom 125, 150 and 175.

The stop is now resolved in points, the unit the caller defined it in, including the fallback past the last stop and the merged consecutive tabs, and only the resulting position is converted to pixels. The regression test was pushed on its own first: the Windows job flagged 45 combinations of zoom, font height and tab length, at 125, 150, 175 and also 200 percent for odd tab lengths.

@github-actions

github-actions Bot commented Aug 8, 2026

Copy link
Copy Markdown
Contributor

Test Results (win32)

   35 files  ±0     35 suites  ±0   5m 17s ⏱️ -20s
4 873 tests +5  4 797 ✅ +5  76 💤 ±0  0 ❌ ±0 
1 400 runs  +5  1 376 ✅ +5  24 💤 ±0  0 ❌ ±0 

Results for commit 3cd0ff7. ± Comparison against base commit 4755f49.

♻️ This comment has been updated with latest results.

TextLayout.setTabs() takes the tab stops in points, but computeRuns()
converted them to pixels and compared them against a pen position
accumulated from raw glyph advances. At zoom levels that are not a
multiple of 100 the point/pixel round trip can place a stop one pixel
past a pen position that actually sits exactly on that stop, so the
tab advanced by a single pixel instead of moving to the next stop.

StyledText hits this because it measures its tab width as the width of
N spaces in points and passes that back as the only tab stop, so a tab
following N spaces lands precisely on the stop. It became visible in
4.36 when monitor-specific scaling turned the effective auto-scale from
"integer" into "quarter", exposing zoom 125, 150 and 175.

Resolve the stop in points instead, including for merged consecutive
tabs, and convert only the resulting position to pixels.

Fixes eclipse-platform/eclipse.platform.ui#3052
@vogella
vogella force-pushed the styledtext-tab-stops branch from 4768d9c to 3cd0ff7 Compare August 8, 2026 07:51
@vogella vogella changed the title [win32] Add a regression test for collapsed tab stops at fractional zoom [win32] Fix collapsed tab stops at fractional zoom levels Aug 8, 2026
@vogella
vogella marked this pull request as ready for review August 9, 2026 07:27
@vogella

vogella commented Aug 9, 2026

Copy link
Copy Markdown
Contributor Author

@HeikoKlare this is a scalling related bug fix, do you want to review?

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.

1 participant