使用 dll 资源中的 WPF 自定义复合字体
我有一个自定义复合字体作为库 dll 中的资源,我想加载它,但我无法获得确切的语法。我尝试过:
FontFamily font = new FontFamily(
new Uri("pack://application:,,,/MyLibraryDll"),
"./fonts/#My Font from composite font");
哪个不起作用,所以我尝试用以下方法枚举字体:
ICollection<FontFamily> fonts = Fonts.GetFontFamilies(
new Uri("pack://application:,,,/MyLibraryDll"),
"./fonts/#My Font from composite font");
并且
ICollection<FontFamily> fonts = Fonts.GetFontFamilies(
new Uri("pack://application:,,,/MyLibraryDll"),
"./fonts/mycompositefont.compositefont#My Font from composite font");
两者都返回计数 0。我找不到关于这些的文档 - 有人对此有任何运气吗?
I have a custom composite font as a resource in a library dll that I'd like to load but I'm unable to get the exact syntax. I tried:
FontFamily font = new FontFamily(
new Uri("pack://application:,,,/MyLibraryDll"),
"./fonts/#My Font from composite font");
Which didn't work so I tried enumerating the fonts with:
ICollection<FontFamily> fonts = Fonts.GetFontFamilies(
new Uri("pack://application:,,,/MyLibraryDll"),
"./fonts/#My Font from composite font");
And
ICollection<FontFamily> fonts = Fonts.GetFontFamilies(
new Uri("pack://application:,,,/MyLibraryDll"),
"./fonts/mycompositefont.compositefont#My Font from composite font");
And both return a count of 0. There is no documentation on these that I can find -- has anyone had any luck with this?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
根据将字体与应用程序打包,正确的语法是:
According to Packaging Fonts with Applications, the correct syntax is: