WPF: Cutting the part of the last letter in textblock when FontStyle is Oblique

237 Views Asked by At

I have a simple XAML example:

<Grid>
<Button x:Name="button1" FontSize="28" FontWeight="Bold" FontStyle="Oblique" HorizontalContentAlignment="Center" Margin="296,142,296,249">
<TextBlock Width="Auto" Text="button" Padding="0" VerticalAlignment="Center"/>
</Button>
<Button x:Name="button2" Content="button" FontSize="28" FontWeight="Bold" FontStyle="Oblique" Margin="296,234,282,146" />       
</Grid>

If height of any button will changed in design mode (or added and changed property Height in xaml), the part of last letter of text in textblocks will surprisingly cut from right side.

here is an image how the cutting of letter looks

The error is only presents on oblique font style ('italic' or 'normal' looks good). Looks like text blocks have uncorrect calculated borders of width in this case.

It can be fixed by changing Padding property (Padding="0,0,6,0"). But it's not a good practice I think.

Could anyone advice how to show oblique fontstyle text correct?

0

There are 0 best solutions below