gpt4 book ai didi

c# - 在 Windows Phone 中嵌入 OTF 字体

转载 作者:行者123 更新时间:2023-11-30 22:06:34 25 4
gpt4 key购买 nike

我需要在 Windows Phone 8 应用程序中使用 OTF 字体。我在 http://blendrocks.com/otf-and-ttf-fonts-in-windows-phone-and-store-apps/ 找到了一篇关于如何做到这一点的文章.我关注了这篇文章,但奇怪的是它不适用于我拥有的字体,但适用于其他字体。

字体文件是一个资源,我这样使用它

<TextBlock Text="BRANDON GROTESQUE" Margin="9,-7,0,0" FontFamily="/FontProblem;component/Fonts/BrandonGrotesque-Regular.otf#BrandonGrotesque-Regular" FontSize="36"/>

我也试过将它转换为 TTF 并根据 http://nicksnettravels.builttoroam.com/post/2013/06/22/TTF-Font-with-Windows-Phone-8.aspx 嵌入它但没有运气。

这是重现问题的完整解决方案:https://dl.dropboxusercontent.com/u/73642/FontProblem.zip

我猜是字体的问题。

最佳答案

如果将 Build Action 设置为 Content,则无需在项目名称前添加,因此您可以使用:

/Fonts/BrandonGrotesque-Regular.otf

只是想让你知道;-)

回到你的问题:
# 之后的文本必须是真实的字体名称(而不是文件系统中的名称)。您可以通过在 Windows 资源管理器(使用 Windows 字体查看器)中打开字体来找到此名称。
它将显示“Brandon Grotesque Regular”。如果字体查看器指定了字体粗细,它会附加字体粗细,但您必须忽略它。
所以你的字体名称是 Brandon Grotesque

你可以这样使用它:

<TextBlock FontFamily="/FontProblem;component/Fonts/BrandonGrotesque-Regular.otf#Brandon Grotesque" />

或者将构建操作设置为内容:

<TextBlock FontFamily="/Fonts/BrandonGrotesque-Regular.otf#Brandon Grotesque" />

已使用您附加的解决方案进行测试

关于c# - 在 Windows Phone 中嵌入 OTF 字体,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/23548050/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com