Center glyphs vertically when lineSpacing > 1#585
Open
Coiggahou2002 wants to merge 1 commit into
Open
Conversation
lineSpacing scales the cell height, but yOffset was left at descent+leading, so all the added space piled above the glyph (text hugged the bottom of the cell). Split the extra evenly above and below so text is vertically centered in the taller cell, which reads better at larger line spacing.
2c8204f to
20e2b12
Compare
Owner
|
I like the idea in principle, but this is not in sync with the caretView, we recently had to address that divergence, should be easy to test if you use a text editor and go to that line, the cursor is likely out of place, This also does not cover metal. Lastly, double-height characters might need to be addressed - check glyphSlotFit for details. |
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.
What
When
lineSpacing > 1, vertically center the glyph within the (now taller) cell, splitting the extra space above and below — instead of leaving it all above the text.Why
lineSpacingscales the cell height incomputeFontDimensions():but
drawTerminalContents()still positions the baseline with the un-scaled offset:Since the row is drawn from the bottom up, the glyph baseline stays pinned to the bottom of the cell and all the added spacing ends up above the text. At larger values (e.g. 1.4–1.6) the lines look bottom-heavy — the gap sits entirely between a line and the line above it, not balanced around each line.
Change
Compute the extra height introduced by
lineSpacingand split it evenly:lineSpacing == 1.0(extra == 0).swift build).This matches how iTerm2 and WezTerm distribute their line spacing.