Asian font not working, what am I doing wrong?
I have a textblock like follows:
This is what I see: http://i.imgur.com/OE4nPzP.png (top is in Expression Blend, bottom is in Unity).
The chinese characters are not visible and the text is a different colour, I'm not sure what I should be doing to try and find out why this isn't working? Unity text meshes do support the chinese characters and I know Noesis supports it too so maybe I'm missing something simple?
Code: Select all
<TextBlock x:Name="TestTextBlock" HorizontalAlignment="Left" Margin="105,22,0,0" TextWrapping="Wrap" Text="abc苹果" VerticalAlignment="Top" Height="48" Width="185"/>
The chinese characters are not visible and the text is a different colour, I'm not sure what I should be doing to try and find out why this isn't working? Unity text meshes do support the chinese characters and I know Noesis supports it too so maybe I'm missing something simple?
-
sfernandez
Site Admin
- Posts: 2984
- Joined:
Re: Asian font not working, what am I doing wrong?
Our default font, Roboto, doesn't include all Unicode characters. To render specific unicode characters you have to use a font file that includes them. I tried to use Arial Unicode MS and Gulim found in my Windows\Fonts folder and I was able to render that text correctly. To use those fonts you have to copy the .ttf to your Unity project (next to your xaml file), and create the corresponding .font for each font. For example, the Gulim.font file would contain the following:
And in the xaml they are referenced as follows:
About the foreground color, if you are using NoesisStyle.xaml this gray color is the default foreground color of all controls.
Code: Select all
gulim.ttc
Code: Select all
<Grid
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
<StackPanel HorizontalAlignment="Center" VerticalAlignment="Center">
<TextBlock Text="abc苹果" FontFamily="#Arial Unicode MS" FontSize="30" Foreground="White"/>
<TextBlock Text="abc苹果" FontFamily="#Gulim" FontSize="30"/>
</StackPanel>
</Grid>
Who is online
Users browsing this forum: No registered users and 3 guests