Using Japanese characters in WPF/XAML
I want to display Japanese chars in my WPF application:
<Window x:Class="WpfApplication1.Window1"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Height="300" Width="300">
<Grid>
<TextBlock Text="はい" FontSize="30" />
</Grid>
</Window>
When I run this app on Windows XP the characters are not shown. Only two squar开发者_StackOverflowes are shown. On Vista they are shown correctly.
Since Visual Studio is able to show them, it should be possible in my app. I should probably change the default font of my application? What font do I need?
Note: I definitely do not want to install additional packages or fonts to get this running! I just want to use the same method as Visual Studio does.
It is a problem with the font. Windows XP got shipped in non-Asian countries with fonts that only contain glyphs that were in common use in those countries. That mattered 9 years ago, XP had to run on machines with very limited resources. If a requested glyph is missing from a font, Windows replaces it with a square.
Short from installing fonts that support Asian language (Control Panel + Regional and Language options), this is not going to be a problem when somebody that runs a Japanese version of Windows looks at your UI. She'll have the right fonts installed.
精彩评论