Strange font rendering problem.
Posted: 12 Dec 2017, 02:38
Hi,
Recently I have updated Noesis from 2.0.2f2 to 2.1.0b10. There are some problems when I try to display chinese characters. When I set FontFamily from a global resource xaml. Not all part of my page xaml can display chinese characters correctly. for example, this is my sample page xaml file:
And here is my resource file:
As the attached image shows, some characters can display correctly (textblock1), some can't (textblock2). All button cannot display correctly unless I set fontfamily embed. Also, please note the character "[" and "]" inside "button1" would been displayed like "→".
Recently I have updated Noesis from 2.0.2f2 to 2.1.0b10. There are some problems when I try to display chinese characters. When I set FontFamily from a global resource xaml. Not all part of my page xaml can display chinese characters correctly. for example, this is my sample page xaml file:
Code: Select all
<UserControl x:Class="Menus.Pages.DeckPage"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008" mc:Ignorable="d"
d:DesignHeight="720" d:DesignWidth="1280">
<UserControl.Resources>
<ResourceDictionary>
<ResourceDictionary.MergedDictionaries>
<ResourceDictionary Source="../Resources/PageResources.xaml" />
</ResourceDictionary.MergedDictionaries>
<ItemsPanelTemplate x:Key="StoriesPanelTemplate">
<WrapPanel Orientation="Horizontal" />
</ItemsPanelTemplate>
<DataTemplate x:Key="StoriesTemplate">
<Border Width="200" Height="350" Margin="10" BorderBrush="Black" BorderThickness="2"
CornerRadius="5">
<Grid>
<TextBlock x:Name="textblock2" Text="中文" FontSize="50" TextAlignment="Center"
Margin="0,50,0,0" />
<TextBlock Text="{Binding Name}" FontSize="18" TextAlignment="Center"
Margin="0,100,0,0" />
</Grid>
</Border>
</DataTemplate>
</ResourceDictionary>
</UserControl.Resources>
<StackPanel Margin="0,20,0,0">
<ItemsControl ItemsSource="{Binding Stories}"
ItemsPanel="{StaticResource StoriesPanelTemplate}"
ItemTemplate="{StaticResource StoriesTemplate}" />
<Button x:Name="button1" Content="[BACK]" Command="{Binding BackCommand}" FontSize="30" />
<Button x:Name="button2" Content="按钮测试1" FontSize="30" />
<Button x:Name="button3" Content="按钮测试2" FontSize="30" FontFamily="{StaticResource DefaultFontFamily}"/>
<TextBlock x:Name="textblock1" Text="中文测试" FontSize="30" />
</StackPanel>
</UserControl>
Code: Select all
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:System="clr-namespace:System;assembly=mscorlib"
xmlns:Converters="clr-namespace:Menus.Converters">
<!-- DEFAULT FONTS -->
<FontFamily x:Key="DefaultFontFamily">../Fonts/#Noto Sans CJK SC</FontFamily>
<Style TargetType="{x:Type TextElement}">
<Setter Property="FontFamily" Value="{StaticResource DefaultFontFamily}" />
</Style>
<Style TargetType="{x:Type TextBlock}">
<Setter Property="FontFamily" Value="{StaticResource DefaultFontFamily}" />
</Style>
<Style TargetType="{x:Type TextBox}">
<Setter Property="FontFamily" Value="{StaticResource DefaultFontFamily}" />
</Style>
......