Repository navigation
Emit glyph padding in rendered-font pixels so it follows text scale - #754
Merged
Merged
Conversation
A bare number in a min-width display spec is measured in the frame's canonical column width, which buffer face remapping (text-scale-mode, buffer-face-mode) does not change. Padded fallback glyphs therefore ended up narrower or wider than their cells whenever the buffer's text scale was not 1, shifting the text after them. Emit the slot width in pixels of the rendered font instead, the same value the glyph scale is already clamped against. Closes #752.
This branch was previously deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #752.
A bare number in a
min-widthdisplay spec is measured in the frame's canonical column width, which buffer face remapping (text-scale-mode,buffer-face-mode) does not change. Padded fallback glyphs therefore ended up narrower or wider than their cells whenever the buffer's text scale was not 1, shifting the text after them.The renderer now emits the slot width in pixels of the rendered font,
(min-width ((PIXELS))), the same value the glyph scale is already clamped against. The pixel form has gone throughcalc_pixel_width_or_heightsincemin-widthwas added in Emacs 29.1, so no version guard is needed. TTY frames are unaffected because glyph adjustment only runs with a window-system font object.Verified live in a GUI Emacs (Menlo 12) by measuring the rendered width of padded glyphs with
window-text-pixel-size:The old spec under-pads above scale 1 and over-pads below it; the new spec fills the slot at every scale.
Tests: existing glyph assertions now expect the pixel form, plus a new test that renders with a remapped default font twice as wide and asserts the padding follows it.