WPF自定义字体渲染

时间:2016-12-22 20:46:04

标签: wpf xaml fonts

我获得了一个自定义字体,可以在我们的企业应用程序中使用。字体本身在Word中看起来很好,但是呈现了#34;提升了#34;通过WPF。考虑下面的屏幕打印:

在WPF中渲染Caliber字体时(我手动绘制了红线): When the Calibre font is rendered in WPF                                                                                                                                                                  

在Word中呈现Calibre字体时: When the Calibre font is rendered in Word XAML:



<StackPanel Orientation="Horizontal" Margin="10,10,0,100">
  <TextBlock Text="Arial" FontFamily="Arial" FontSize="48" Padding="5,0" Margin="0" Background="AntiqueWhite" VerticalAlignment="Center" />
  <TextBlock Text="Arial Bold" FontFamily="Arial Bold" FontSize="48" Padding="5,0" Margin="0" Background="AntiqueWhite" VerticalAlignment="Center"  />
  <TextBlock Text="Calibre Regular" FontFamily="Calibre Regular" FontSize="48" Padding="5,0" Margin="0" Background="AntiqueWhite" VerticalAlignment="Center"  />
  <TextBlock Text="Calibre Bold" FontFamily="Calibre Bold" FontSize="48" Padding="5,0" Margin="0" Background="AntiqueWhite" VerticalAlignment="Center"  />
  <TextBlock Text="Calibri Regular" FontFamily="Calibri" FontSize="48" Padding="5,0" Margin="0" Background="AntiqueWhite" VerticalAlignment="Center"  />
  <TextBlock Text="Calibri Bold" FontFamily="Calibri Bold" FontSize="48" Padding="5,0" Margin="0" Background="AntiqueWhite" VerticalAlignment="Center"  />
</StackPanel>
&#13;
&#13;
&#13;

有什么想法吗?我真的很难过这个!

1 个答案:

答案 0 :(得分:0)

好的,我偶然发现了一个问题。我在名为Type Light的免费字体编辑器中打开字体,以验证字体中的所有内容是否正确。我将字体保存为新文件并尝试该文件。它解决了这个问题。显然,OTF文件出了问题。

http://www.cr8software.net/typelight.html