Skip to content

Imprecise selected font size from FontDialog #412

@HeikoKlare

Description

@HeikoKlare

The FontData returned by a FontDialog currently contain a hight that does not completely fit to the actual selected size. The current implementation creates a font handle based on the selection in the dialog to extract information about the font size out of that created font. Due to point/pixel conversion and roundings that depend on the current DPI (affected by the primary monitor zoom), the resulting font size selected differs from what the user has selected.
For example, when selecting a 10pt font, the result of the dialog will contain a height of 9.75pt on a 100% monitor and of 10.2pt on a 125% monitor.
At the same time, the dialog manages the logically selected size, i.e., in the given scenario the selected 10pt, which could be used instead.

The behavior can, e.g., be seen when adding a System.out.println(fontData.height) after opening the dialog in Snippet133 (currently line 141) and selecting font height "10".

The dialog implementation shall be adapted such that it returns the exact logical size selected by the user.

Metadata

Metadata

Assignees

No one assigned

    Labels

    HiDPIA HiDPI-Related Issue or FeatureSWTIssue for SWT

    Type

    No type

    Projects

    Status

    ✅ Done

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions