Skip to content
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 text rendering where TextAlignment != Left. #2344

Merged
merged 4 commits into from
Mar 14, 2019

Conversation

grokys
Copy link
Member

@grokys grokys commented Mar 4, 2019

What does the pull request do?

Fixes rendering of TextBlocks where TextAlignment != Left as described in #1625.

What is the current behavior?

If TextAlignment != Left, the bounds passed to TextNode do not accurately reflect the bounds of the text to be drawn, causing changes to the TextBlock to not get rendered.

What is the updated/expected behavior with this PR?

Non-left aligned text is updated correctly by the renderer.

How was the solution implemented (if it's not obvious)?

To use the correct bounds, this PR changes FormattedTextImpl.Size to Bounds, which returns a rect that takes into account the text alignment and similarly changes FormattedText.Measure to a property Bounds.

Breaking changes

FormattedText.Measure() changed to Bounds property.

Fixed issues

Fixes #1625

cc: @Gillibald

The renderer was using the wrong bounds for text where `TextAlignment != Left` as seen in #1625. To fix this, change `FormattedTextImpl.Size` to `Bounds`, which returns a rect that takes into account the text alignment and similarly change `FormattedText.Measure` to return a `Rect` instead of a `Size.

Fixes #1625.
@grokys grokys requested a review from a team March 4, 2019 12:36
@grokys
Copy link
Member Author

grokys commented Mar 14, 2019

Going to merge this despite no approvals because @Gillibald has taken a look and it's been 10 days.

@grokys grokys merged commit 61c4c65 into master Mar 14, 2019
@grokys grokys deleted the fixes/1625-textalignment-bounds branch March 14, 2019 13:19
@grokys grokys added this to the 0.8.0 milestone Apr 3, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants