-
-
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
Fix: Multi-line text rendered outside control boundaries #17891
Fix: Multi-line text rendered outside control boundaries #17891
Conversation
The GlyphAdvance should not be altered. Please add a unit tests for the actual issue. Then find a solution that solves this without altering the GlyphAdvance. Did you tests the behavior against latest master? |
You can test this PR using the following package version. |
@Gillibald The GlyphAdvance altering seems like the best way to me, the GlyphAdvance altering is also implemented in
Once another solution is found (if the current one is not acceptable), then I can add unit tests according to the solution.
Yes |
Trailing whitespace is hit testable for FlowDirection.LeftToRight so it should also be hit testable for FlowDirection.RightToLeft. Your changes make that impossible. |
There is something wrong with TextWrapping and trailing whitespaces. The TextLayout is bigger than the constraint sometimes which causes some issues. |
I just checked the Adobe InDesign behavior in this case, and it also compresses the whitespaces width, even there they are not hit testable. |
You can test this PR using the following package version. |
@Gillibald Is the correct solution to reset the bidi levels for whitespaces at the end of a line to the paragraph embedding level after text wrapping? https://www.unicode.org/reports/tr9/#L1 Would this be an acceptable solution? |
It looks like trailing whitespace should always be at the end in the resolved direction. So this means if the resolved level is RTL the whitespace should be visible at the left side. |
What does the pull request do?
It fixes a bug that causes multi-line text to render outside the control's boundaries, resulting in truncated or completely hidden text.
What is the current behavior?
Multi-line text sometimes truncated at the control's boundaries or is not displayed at all. This can happen due to two reasons:
TextLayout
constraint size (stored inTextPresenter._constraint
field) duringArrangeOverride
, causing text to render outside the control's boundaries.Example gif:
Xaml Code
Gif 1
Gif 2
What is the updated/expected behavior with this PR?
Text is displayed accurately and without truncation.
Example gif:
How was the solution implemented (if it's not obvious)?
CompressReversedTrailingWhitespace
method to check for reversed trailing whitespace due to bidi processing, and if found, sets theGlyphAdvance
of whitespace glyphs to 0.TextPresenter.ArrangeOverride
to check the actualfinalSize
instead offinalSize
including trailing whitespace for TextLayout constraint size.Checklist