-
Notifications
You must be signed in to change notification settings - Fork 185
Description
Describe the bug
When using an environment and swt.autoScale configuration that leads to an auto-scaled device zoom that is larger than native zoom, the line heights in a StyledText will become too large (scaled according to device zoom instead of native zoom).
It is a regression as a combination of two PRs:
- [win32] Fetch Font#handle through SWTFontProvider #2062 wrongly introduced the usage of an auto-scaled zoom instead of native zoom for retrieving a font handle
- Deprecate DefaultSWTFontRegistry and Completely switch to ScalingSWTFontRegistry #2212 exchanged the font registry which by then implicitly corrected the above mistake.
To Reproduce
The behaviore can probably be reproduced with CustomControlExample's StyledText tab, but it's most simple to do with an Eclipse SDK:
- Set primary monitor zoom to 175%
- Start an Eclipse SDK with disabled monitor-specific scaling (e.g.,
swt.autoScale.updateOnRuntime=false) - Open any StyledText such as a Java code editor
You will see that line height are slightly to high.
To compare with the intended behavior, you can either enabled monitor-specific scaling or start the application with Dswt.fontRegistry=legacy, as the previously used fixed-zoom font registry worked around that issue.
Expected behavior
The line height to always be correct according to the font size / native zoom.
Screenshots
The left shows a StyledText with the reproduction scenario (175% primary monitor zoom, monitor-specific scaling disabled), the right shows the same StyledText with -Dswt.fontRegistry=legacy leading to the expected behavior:

Environment:
- Select the platform(s) on which the behavior is seen:
-
- All OS
-
- Windows
-
- Linux
-
- macOS
Version since
I20250606-1800