-
-
Notifications
You must be signed in to change notification settings - Fork 2.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Make sure GlyphRunImpl.InkBounds are always at a positive location #16601
Make sure GlyphRunImpl.InkBounds are always at a positive location #16601
Conversation
You can test this PR using the following package version. |
Just a though, aren't the negative bounds returned because of the edging? Avalonia/src/Skia/Avalonia.Skia/GlyphRunImpl.cs Lines 54 to 58 in d1cdb29
This comment says that the result could be shifted by 1px, but it could also probably be -1px depending on the font. Since that negative bound might apply to several other characters in the run and not only the first, won't shifting the bounds of the whole run potentially cause other problems, for example with hit testing? Also, should we add a render test here to avoid future regressions? |
Y sounds like we need a render test |
So ideally glyph bounds should never affect layout. So each glyphs anchor point should be adjusted to the expected glyph advances. In the end this should only matter for the first glyph's bounds because these define the left edge of a run. |
You can test this PR using the following package version. |
You can test this PR using the following package version. |
What does the pull request do?
For an unknown reason, Skia reports glyph bounds at a negative x-position which causes some alignment issues for monospace fonts. This PR makes sure glyph bounds are always at a positive position.
What is the current behavior?
What is the updated/expected behavior with this PR?
How was the solution implemented (if it's not obvious)?
Checklist
Breaking changes
Obsoletions / Deprecations
Fixed issues
Fixes: #16555