3

For the most part, my app renders different character sets without problems. There are, however, certain Chinese characters that render fine when FontSize is 22, but horribly when it is smaller:

Chinese strings

This was rendered by the following piece of XAML, which works for both WPF and UWP, with the same problematic results:

<Grid Background="{ThemeResource ApplicationPageBackgroundThemeBrush}">
    <Grid.RowDefinitions>
        <RowDefinition Height="Auto" />
        <RowDefinition Height="Auto" />
        <RowDefinition Height="Auto" />
        <RowDefinition Height="Auto" />
    </Grid.RowDefinitions>
    <TextBox x:Name="textBox" Grid.Row="0" FontSize="21" Text="〾⿰⿱⿲⿳⿴⿵⿶⿷⿸⿹⿺⿻" />
    <TextBox Grid.Row="1" FontSize="22" Text="{Binding Text, ElementName=textBox}" />
    <TextBlock Grid.Row="2" FontSize="21" Text="{Binding Text, ElementName=textBox}" />
    <TextBlock Grid.Row="3" FontSize="22" Text="{Binding Text, ElementName=textBox}" />
</Grid>

The second and fourth line shows how the string is supposed to look; the first and third show garbled versions.

The answer to this somewhat related question suggests setting FontFamily="SimSun", which does indeed cause things to be displayed correctly. My options, then, currently seem to be:

  • Change the font family from the default "Segoe UI" to "SimSun"
  • Increase the font size from 15 to 22

Neither option is appealing. Does anyone have other suggestions? Or an explanation for why those particular characters are so troublesome?

Community
  • 1
  • 1
Petter Hesselberg
  • 5,062
  • 2
  • 24
  • 42

1 Answers1

1

Turns out FontWeight="Light" does the trick:

enter image description here

Medium, Normal and SemiLight all fail. Light, SemiBold, Thin, Bold, ExtraBold, Black, ExtraBlack and ExtraLight all solve the problem.

If anyone knowledgeable about this area has something to contribute, I'm still interested, as I have no idea what causes this behavior.

Petter Hesselberg
  • 5,062
  • 2
  • 24
  • 42