Fix text bounds cutoff in iced_wgpu#2975
Merged
hecrj merged 2 commits intoiced-rs:masterfrom Jun 3, 2025
Merged
Conversation
Member
|
Is this fixed by #2768? |
Contributor
|
No, however the result is a similar kind of snapping, the only difference being the top left point being truncated instead of rounded. Maybe that could be done here as well, though I can hardly say whether it'll be an issue in this case. This needs a cryoglyph rectangle, which has signed coordinates (for some reason) so the existing snap fn wasn't used before or now. |
hecrj
requested changes
Jun 3, 2025
iced_wgpu
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 #2963
The current wgpu text bounds implementation casts the right and bottom bound to an integer without rounding, leading to letters not being displayed fully.
In this example there is a combo box on the left with a
0.2pxvertical space and an input box on the right without a vertical space. The default font size is16px, leading to a default line height of1.3 * 16px = 20.8px. With a0.2pxvertical space the bottom bound equals to a whole integer coordinate, so the letters are displayed correctly. On the right the bound is cast from20.8pxto20px, loosing almost a pixel of all letters extending to the bottom line:This PR matches the line bound calculation of tinyskia and
rounds the text bounds: