Skip to content

Keep PaintQuad source-compatible with upstream, and add letter spacing - #24

Open
nodelike wants to merge 2 commits into
sonorahq:masterfrom
nodelike:feat/letter-spacing
Open

nodelike wants to merge 2 commits into
sonorahq:masterfrom
nodelike:feat/letter-spacing

Conversation

@nodelike

Copy link
Copy Markdown

Two changes that came out of building Sikemux's desktop UI on this fork with GPUI Kit patched onto it through [patch.crates-io].

Keep PaintQuad as upstream has it

Corner smoothing added a public corner_smoothing field to PaintQuad, which breaks every struct literal of it written against upstream GPUI. GPUI Kit's gpui-base has four, so Kit doesn't build against the fork.

Smoothing now rides on a new SmoothQuad { quad, corner_smoothing }:

  • PaintQuad::corner_smoothing returns a SmoothQuad.
  • Window::paint_quad takes impl Into<SmoothQuad>, so existing calls with a PaintQuad are unchanged.
  • Rendering is the same as before.

Letter spacing

Styled::letter_spacing(ems) works like CSS letter-spacing.

  • It's a LetterSpacing on Font, TextStyle and each FontRun, so it cascades like the other text styles and is part of the line cache key.
  • It's applied once, in LineLayoutCache, after the platform text system shapes the line. CoreText and cosmic-text give the same result.
  • Each character gets the space after it, and the line's width grows by all of it.
  • A cluster shaped into one glyph (a base and its combining marks) is spaced once.

Known limit: LineWrapper still measures characters without it, so wrapped text with letter spacing can break a little late. Spaced text is usually a single-line label, so I left that out of this PR.

Adding a field to Font and FontRun breaks code that builds them without ..Default::default(). GPUI Kit's non-test code doesn't do that; this PR updates the fork's own tests and benches.

Checked

  • cargo check --all-targets for gpui, gpui_apple, gpui_macos, gpui_wgpu and gpui_platform.
  • cargo test --lib for gpui, gpui_apple and gpui_wgpu, plus two new tests for the spacing pass. Five debug_overlay / bench_context tests fail with or without this PR on macOS.
  • GPUI Kit 0.8.0 builds against the fork with these changes, and the spaced capitals in Sikemux's rail headers render as one run.

nodelike added 2 commits October 21, 2026 06:49
…pre compiles

Corner smoothing added a public field to PaintQuad, which broke every struct
literal of it outside the fork (GPUI Kit builds four). Smoothing now rides on
SmoothQuad, which PaintQuad::corner_smoothing returns, and paint_quad takes
either.

Agent: Stag (claude 2.1.296, opus[1m], sikemux 0.5.4-nightly.3, session 66925b4c-f9c4-465f-a5ce-3e4ebcd2a74b, chat agent-96d17a8eae85473a989a96750723befa, host 03c112f7c38a48c2)
Agent-Signature: pZtXBYHgwzesOlFkvtmr+ANwVQj30f4mPdzI/GhxBB7MdYi7lqYFPmX6D1eNOBX1JErhWHue9MxREWvPFuh4BQ
Styled::letter_spacing takes ems of the font size. It rides on Font and on
each FontRun, so it is part of the line cache key, and is applied once after
shaping, which gives every text system the same result. Each character gets the
space after it; a cluster shaped into one glyph is spaced once, and the line's
width grows by all of it.

Agent: Stag (claude 2.1.296, opus[1m], sikemux 0.5.4-nightly.3, session 66925b4c-f9c4-465f-a5ce-3e4ebcd2a74b, chat agent-96d17a8eae85473a989a96750723befa, host 03c112f7c38a48c2)
Agent-Signature: BbRWqG10sjJIzeosST0Xnq+UKSbPYsjpxil+7qE+Sia+xvGv9KPCWHMx9vrIQqrSZwnZycJW1B5e4BioAeK4Cw
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