Repository navigation
Fix text background, underline and strikethrough leaving the row when TextFormat::line_height is set - #8941
Open
iamseeley wants to merge 5 commits into
Open
Fix text background, underline and strikethrough leaving the row when TextFormat::line_height is set#8941iamseeley wants to merge 5 commits into
TextFormat::line_height is set#8941iamseeley wants to merge 5 commits into
Conversation
|
Preview is being built... Preview will be available at https://egui-pr-preview.github.io/pr/8941-thomas/text-background-font-height View snapshot changes at kitdiff |
TextFormat::line_height is set
iamseeley
added a commit
to membrane-io/egui
that referenced
this pull request
Nov 24, 2026
iamseeley
added a commit
to membrane-io/egui
that referenced
this pull request
Nov 24, 2026
…t test, a RichText snapshot
iamseeley
marked this pull request as ready for review
November 24, 2026 19:32
Contributor
|
This looks like a useful follow-up to #8030. |
2 tasks done
This branch has not been 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.
Since #8030, a custom
TextFormat::line_heightcenters the text in the line. But the background (#8872), the underline and the strikethrough still useGlyph::logical_rect(), which starts at the top of the font and isline_heighttall. So with a taller line height they reach past the bottom of the row. Withline_height = 40, the background of 14 pt monospace was 11.5..52.5 in a 0..40 row. Now it is 11.5..29.5.This adds
Glyph::font_rect()and uses it for all three. A line height shorter than the font now gets a background that covers the whole font, like an inline<code>with a smallline-heightin CSS. Without a customline_height, nothing changes.The scene of the new snapshot, with
line_height = 28, atpixels_per_point = 2:Tests: one unit test, which fails without the change, and a new snapshot
code_background_tall_line_height.Open question
Should
Glyph::logical_rect()change instead? After this PR, nothing in egui uses its height. Since #8030 its height reaches below the line whenline_heightis set.