Skip to content

Options dialog edits the font size in pixels, not points #3996

Description

@siegfriedpammer

The font size in Options > Display is edited as device-independent pixels, while the WPF host presented it in points. The stored value is unchanged, so only the number the user sees and types is wrong.

DisplaySettings.SelectedFontSize holds device-independent pixels and is consumed as such (DecompilerTextEditor, EditorZoom.EffectiveFontSize, and the preview TextBlock), with the default written as 10.0 * 4 / 3 — 10 pt expressed in pixels:

https://github.com/icsharpcode/ILSpy/blob/3ec7e5f82/ILSpy/Options/DisplaySettings.cs#L40

The options panel binds that value straight to a NumericUpDown:

https://github.com/icsharpcode/ILSpy/blob/3ec7e5f82/ILSpy/Options/DisplaySettingsPanel.axaml#L29-L31

The WPF panel put a converter in between, Math.Round(d / 4 * 3) for display and d * 4 / 3 on the way back (FontSizeConverter in the pre-Avalonia DisplaySettingsPanel.xaml.cs), so the box showed points. That converter has no counterpart in the Avalonia port.

Consequences:

  • On a fresh profile the size box reads 13.333… rather than 10.
  • Increment="1" steps by one pixel, i.e. 0.75 pt.
  • Minimum="6" / Maximum="72" are pixels, so the reachable range is 4.5 pt to 54 pt — the usual 6-72 pt range is not.
  • A settings file written by ILSpy 9.x (WPF) round-trips correctly, since the persisted attribute is pixels in both hosts; it is only the dialog that disagrees about the unit.

Either convert for display as WPF did, or keep pixels and drop the pt-derived default and range so the dialog is at least self-consistent.

Reported by an AI agent (Claude) on Siegfried's behalf.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions