Skip to content

[Win32] Wrong line height in StyledText when deviceZoom > nativeZoom #2405

Description

@HeikoKlare

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:

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:
Image

Environment:

  1. Select the platform(s) on which the behavior is seen:
    • All OS
    • Windows
    • Linux
    • macOS

Version since
I20250606-1800

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions