shaping: round the cell width to the nearest pixel #411
No reviewers
Labels
No labels
priority/P0
priority/P1
priority/P2
release/v0.1.0
status/blocked
status/planned
type/bug
type/design
type/test-gap
type/tracker
No milestone
No project
No assignees
1 participant
Due date
No due date set.
Dependencies
No dependencies set
Reference
natsukium/felis!411
Loading…
Reference in a new issue
No description provided.
Delete branch "shaping/round-cell-width"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
What
CellMetrics::from_scaledrounds the cell width to the nearest pixel instead of ceiling it (the.max(1.0)floor stays, so a sub-half-pixel advance still yields a 1 px cell). Height keeps its separate ceil of ascent and descent.docs/explanation/rendering/text-shaping.md"Atlas integration" is rewritten with what kitty actually does, why rounding is safe, the rejected alternatives, why height keeps its rule, and a "Revisit if" trigger. CHANGELOG gains a "Changed" entry, since a window of a given size now holds more columns at the samefont.size_px.Why
The ceil was justified by "kitty ceils the same advance". That holds only on macOS, where kitty ceils CoreText's unhinted advance. On Linux kitty ceils a FreeType advance that hinting has already rounded to a whole pixel, so its effective rule there is round. felis therefore drew 12 px cells where kitty, alacritty and foot draw 11 (issue diagnosis comment has the source walk).
Measured
Menlo on the Mac via CoreText: advance 8.4287, ascent 12.9951, descent 3.3018, leading 0, matching the DejaVu-derived numbers in the diagnosis.
Spill with the new width, measured on felis's own Linux (hinted) raster at 18.67 px in an 11 px cell: ASCII ink reaches at most one column into the neighbor (
_44% coverage,#41%,W36%); nothing reaches further or left of the cell. Backgrounds paint before any glyph and glyph quads are not clipped to the cell, so the spill is drawn over the neighbor.Height is unchanged (23 px on Linux, matching every peer; 17 px for Menlo on macOS where peers get 16): rounding the descent would reach 16 on macOS but drop Linux to 22.
just check: fmt, clippy, portable, prose, skills, docs-links, deny, proto-compat and release-check pass; nextest 3542/3543 on the full run, the one failure (os_clipboard::tests::write_primary_program_lands_when_program_writes_allowed, a live PRIMARY selection test) and two earlier load flakes infelis-cli/felis-daemonpass in isolation and do not touch shaping.Closes #404
73c81c26271b7c652df0natsukium referenced this pull request2026-09-26 01:13:35 +09:00