Repository navigation
fix: centre the highlighted-lines chip text - #86
Merged
Merged
Conversation
The chip's line box keeps room for descenders that a label such as "L1-3" never uses, so in Chromium the text sat about 1px above the middle. Browsers that support text-box now trim the line box to the cap height and the baseline, and the padding sets the space instead. Firefox does not support text-box yet and keeps the old layout.
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.
The highlighted-lines chip in the title bar had its text off centre.
Its line box keeps room for descenders that a label such as "L3" or "L1-3" never uses.
In Chromium the text sat about 1px above the middle of the chip.
The chip now uses
text-box: trim-both cap alphabeticinside@supports.This trims the line box to the cap height and the baseline, and a padding of
0.3emsets the space above and below.Firefox doesn't support
text-boxyet, so it keeps the old layout and the old size.I measured the gap below the text minus the gap above it, averaged over 8 sub-pixel positions.
In HTML it went from +0.99px to -0.55px in Chromium.
In WebKit (Playwright's 26.5 build) it went from -0.55px to -1.06px, so the text there now sits about half a pixel lower than before.
I haven't checked real Safari yet.
Reveal.js slides use the same rule, and Typst needs no change, because Typst already trims text to the cap height and the baseline.