Skip to content

Italic text gets clipped #21255

@gerhard17

Description

@gerhard17

Describe the bug

The bounding size of italic text is calculated wrong.

In this example with Avalonia.Fonts.Inter all italic text has a display problem:

Image

To Reproduce

<TextBlock Text="clipped" Background="#442211" VerticalAlignment="Center"/>
<TextBlock Text="clipped" Background="#442211" VerticalAlignment="Center" FontStyle="Italic"/>
<TextBlock Text="clipped" Width="60" TextAlignment="Right" Background="#442211" VerticalAlignment="Center"/>
<TextBlock Text="clipped" Width="60" TextAlignment="Right" Background="#442211" VerticalAlignment="Center" FontStyle="Italic"/>

The same problem arises if you exchange the TextBlock with a TextBox.

Expected behavior

Italic text is proper clipped.

Avalonia version

Was is 11.x and still exists in 12.x

OS

Windows

Additional context

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions