Skip to content

Conversation

@Gillibald
Copy link
Contributor

@Gillibald Gillibald commented Jan 7, 2026

What does the pull request do?

The TextLineImpl is currently using the default TextMetrics to calculate the initial descent, ascent, and line gap. This causes an issue with TextLines that only contain an EmbeddedControlRun with no descent, and therefore, the final descent should be zero. This PR ensures the descent is zero instead of the default value of the currently active font.

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

@Gillibald Gillibald added bug regression backport-candidate-11.3.x Consider this PR for backporting to 11.3 branch area-textprocessing labels Jan 7, 2026
@avaloniaui-bot
Copy link

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

@MrJul
Copy link
Member

MrJul commented Jan 7, 2026

The changes mean that the paragraph's ascent/descent/linegap properties won't be applied anymore even to normal text runs.

Code:

<TextBlock FontFamily="/Assets/#Noto Sans Arabic" TextWrapping="Wrap" Width="200">
  <Run Text="رقم التسلسل" />
  <Run Text="Serial Number Serial Number Serial Number" FontFamily="Arial" />
</TextBlock>

Font: Noto Sans Arabic

Before (master):
image

After (PR):
image

Copy link
Member

@MrJul MrJul left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This breaks some other scenarios, see comment above.

@Gillibald
Copy link
Contributor Author

Gillibald commented Jan 7, 2026

Paragraph properties are inherited if a TextRun does not override them. If all runs are fallback runs we no longer apply the "wrong" metrics. Do we want that?

@Gillibald
Copy link
Contributor Author

This needs more discussion about how we want to handle text metrics for the line height calculation

@Gillibald Gillibald closed this Jan 13, 2026
@MrJul MrJul removed the backport-candidate-11.3.x Consider this PR for backporting to 11.3 branch label Jan 13, 2026
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.

Unexpected descent on InlineUIContainer

4 participants