Skip to content

Keep an edited caption sharp when its size changes - #17

Merged
ursasi merged 1 commit into
mainfrom
fix/caption-crisp-text
Oct 26, 2026
Merged

ursasi merged 1 commit into
mainfrom
fix/caption-crisp-text

Conversation

@ursasi

@ursasi ursasi commented Oct 26, 2026

Copy link
Copy Markdown
Owner

Changing the type size while typing a caption made the text look blurred.

Two causes, both in the editor:

  • The size control set the control's font but left the text run carrying its old .font attribute, so AppKit scaled the existing glyphs up to the new size instead of shaping them — blurry, and worse the further the size moved.
  • The editor was positioned at the raw pointer point and resized to a fractional height (layout.usedRect), which puts glyphs between pixels and softens every edge.

The new font is now applied to the whole text storage, plus the typing attributes so following keystrokes match; the frame's origin is rounded and its height is ceiled on every change.

check result
type at 26 pt, scroll up 3 notches text re-shaped at the new size, edges sharp at 4× zoom
further scrolling stays sharp; height only moves by whole points

Changing the type size set the control's font but left the text run with its old
font attribute, so AppKit scaled the existing glyphs up — which reads as blur.
The new font is applied to the whole storage (and to the typing attributes, so
what comes next matches). The editor's frame is also kept on whole points now: a
fractional origin or height puts the glyphs between pixels and softens every
edge, which gets worse the more times the size changes.
@ursasi
ursasi merged commit 9e552cd into main Oct 26, 2026
1 check passed
@ursasi
ursasi deleted the fix/caption-crisp-text branch October 30, 2026 10:47
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