Skip to content

TextBlock FontWeight/FontStyle not correctly rendered when FontFamily set to Chinese type #20709

@ywwgod

Description

@ywwgod

Describe the bug

Hello, I've got two prolem with TextBlock/SelectableTextBlock.
1.When I set Inlines, if the fontfamily is English type, it's ok, but if it is Chinese, the run with FontWeight set to Bold is not rendered correctly.

Image

2.Watch the two images below, each third TextBlock is same, but they are rendered differently, only because the second TextBlock has a little difference.

Image Image

To Reproduce

 <Grid ColumnDefinitions="*,*,*">
  <TextBlock
Grid.Column="0"
Background="Transparent"
HorizontalAlignment="Center"
VerticalAlignment="Center"
FontStyle="Oblique"
Margin="0 90 0 0"
FontFamily="Arial">
		<Run >AAA</Run>
		<Run FontWeight="Bold">BBB</Run>
		<Run FontWeight="Bold">这是</Run>
		<Run >一段</Run>
</TextBlock>
  <TextBlock
Grid.Column="1"
Background="Transparent"
HorizontalAlignment="Center"
VerticalAlignment="Center"
FontStyle="Oblique"
Margin="0 90 0 0"
FontFamily="宋体">
		<Run >AAA</Run>
		<Run FontWeight="Bold" FontStyle="Normal">BBB</Run>
		<Run FontWeight="Bold">这是</Run>
		<Run >一段</Run>
</TextBlock>
  <TextBlock
Grid.Column="2"
Background="Transparent"
HorizontalAlignment="Center"
VerticalAlignment="Center"
FontStyle="Oblique"
Margin="0 90 0 0"
FontFamily="宋体">
		<Run >AAA</Run>
		<Run FontWeight="Bold">BBB</Run>
		<Run FontWeight="Bold">这是</Run>
		<Run >一段</Run>
</TextBlock>
 </Grid>

Expected behavior

No response

Avalonia version

11.3.12

OS

Windows

Additional context

No response

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions