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 TextAlignment="DetectFromContent" #17721

Merged
merged 2 commits into from
Dec 10, 2024

Conversation

Gillibald
Copy link
Contributor

@Gillibald Gillibald commented Dec 9, 2024

What does the pull request do?

This PR reworks the way TextLayout computes its metrics. It now builds a union of all text line bounds and calculates the minimal required width of the TextLayout to render all lines without wrapping or trimming. This is required to horizontally align text constrained by a width greater than the required width.

What is the current behavior?

Currently, the TextLayout takes all the available space and there is no way to know what the minimal required width is so text gets layout bigger than it should be.

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: #16009

@Gillibald Gillibald added the backport-candidate-11.2.x Consider this PR for backporting to 11.2 branch label Dec 9, 2024
@avaloniaui-bot
Copy link

You can test this PR using the following package version. 11.3.999-cibuild0053767-alpha. (feed url: https://nuget-feed-all.avaloniaui.net/v3/index.json) [PRBUILDID]

@maxkatz6 maxkatz6 added this pull request to the merge queue Dec 10, 2024
Merged via the queue into AvaloniaUI:master with commit 894d238 Dec 10, 2024
10 checks passed
maxkatz6 pushed a commit that referenced this pull request Dec 19, 2024
@maxkatz6 maxkatz6 added backported-11.2.x and removed backport-candidate-11.2.x Consider this PR for backporting to 11.2 branch labels Dec 19, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

TextAlignment.DetectFromContent with an RTL line and TextWrapping produces a width of 0
3 participants