2015-08-19 23 views
0

我想在我的通用Windows应用程序中使用自定义的otf字体,但我无法使其工作。如何使用此字体?

我目前我xaml使用此:

<TextBlock 
    FontSize="16" 
    Text="Question" 
    FontFamily="../Assets/Fonts/NeoSansStdMedium.otf#Neo Sans Std Medium"/> 

字体位于Assets/Fonts,像这样:

Project.Windows (Windows 8.1) 
    > Assets 
     > Fonts 
      > NeoSansStdMedium.otf 

而Windows Fontviewer显示字体名称:

Neo Sans Std Medium 

那么我在做什么错了?

+0

你有没有嵌入字体(生成操作) –

+0

@ErnodeWeerd在属性'建设Action'是'Content'。将'Build Action'设置为'Embedded Resource'不能解决它。 – vrwim

回答

2

的#后的字体名称必须匹配的字体名称,在这种情况下显然Medium不是名称的一部分......

一些更多的信息:我设置了.otf文件的属性,以Build Action: ContentCopy to Output Directory: Do not Copy

的XAML摘录现在看起来是这样的:

<TextBlock 
    FontSize="16" 
    Text="Question" 
    FontFamily="../Assets/Fonts/NeoSansStdMedium.otf#Neo Sans Std"/>