有没有办法在Windows Phone 8中使用fontello ttf图标?

时间:2014-08-11 20:03:45

标签: windows-phone-8 fonts

我需要在我的Win8手机项目中使用ttf作为一些图标。我做了一项研究,但找不到任何资源。有没有办法实现这个目标?

<TextBlock x:Name="textBlock" Text="\uE82E" FontFamily="/fontello.ttf#fontello" /> 

enter image description here

enter image description here

自定义字体运行时

TextBlock t = new TextBlock();
FontFamily ff = new FontFamily("/Fonts/fontello.ttf#fontello");
t.FontFamily = ff;
t.Text = "&#xE821";

1 个答案:

答案 0 :(得分:3)

您可以这种方式指定Unicode值:

XAML:

<TextBlock x:Name="textBlock" Text="&#xE82E;" FontFamily="fontello.ttf#fontello" /> 

代码背后:

textBlock.FontFamily = new FontFamily("fontello.ttf#fontello");
textBlock.Text = "\uE82E";