Topic Author
Posts: 17
Joined: 22 Sep 2013, 09:35

Asian font not working, what am I doing wrong?

13 Oct 2013, 14:05

I have a textblock like follows:
<TextBlock x:Name="TestTextBlock" HorizontalAlignment="Left" Margin="105,22,0,0" TextWrapping="Wrap" Text="abc苹果" VerticalAlignment="Top" Height="48" Width="185"/>
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?
User avatar
Site Admin
Posts: 3064
Joined: 22 Dec 2011, 19:20

Re: Asian font not working, what am I doing wrong?

14 Oct 2013, 11:12

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:
    <StackPanel HorizontalAlignment="Center" VerticalAlignment="Center">
        <TextBlock Text="abc苹果" FontFamily="#Arial Unicode MS" FontSize="30" Foreground="White"/>
        <TextBlock Text="abc苹果" FontFamily="#Gulim" FontSize="30"/>
unicode.png (8.19 KiB) Viewed 2180 times
About the foreground color, if you are using NoesisStyle.xaml this gray color is the default foreground color of all controls.

Who is online

Users browsing this forum: Bing [Bot] and 2 guests