简体   繁体   English

试图为一个Windows商店应用程序调用EnumFontFamilies(...)说它是未定义的。 这是为什么? 还有其他选择吗?

[英]trying to call EnumFontFamilies(…) for a windows store app says it's undefined. Why is that? Are there any alternatives?

I'm trying to have a list of the fonts installed on a Surface. 我正在尝试列出Surface上安装的字体。 However, even after including , I can't call EnumFontFamilies. 但是,即使包括在内,我也无法调用EnumFontFamilies。 Why is that? 这是为什么? How could I, and if I can't, what can I do to achieve similar functionnality. 我怎么能,如果我不能,我能做些什么来实现类似的功能。 Thanks. 谢谢。

From a thread on the Dev Center forums , it looks like you could do this via C++/DirectX as a WinRT component (the code here would be a start). 开发人员中心论坛上的一个帖子看,你可以通过C ++ / DirectX作为WinRT组件来实现这一点( 这里代码将是一个开始)。

or take a look at Christophe Wille's WinRT snippets project on GitHub 或者在GitHub上查看Christophe Wille的WinRT片段项目

EnumFontFamilies() is a winapi function. EnumFontFamilies()是一个winapi函数。 Very few of which you can use in a Store app, certainly not this one. 只有少数的,你可以在商店应用中使用,肯定没有这一项。 Technically you can hack the macros that stop you from using the function but then you won't pass the Store validation. 从技术上讲,你可以破解阻止你使用该功能的宏,但是你不会通过商店验证。

You'll find font related methods in the Windows.Globalization.Fonts namespace, but not what you are looking for. 您将在Windows.Globalization.Fonts命名空间中找到与字体相关的方法,但不是您要查找的方法。 Note the namespace name, WinRT no longer ignores the fact that the fonts that are available and usable on a machine have a lot to do with the language a user speaks. 注意命名空间名称,WinRT不再忽略这样一个事实,即机器上可用和可用的字体与用户说的语言有很大关系。 Or rather, the glyphs used in written text for that language. 或者更确切地说,该语言的书面文字中使用的字形。 Arbitrarily picking in font just doesn't work well for the billions of people that live in Asia. 任意选择字体对于生活在亚洲的数十亿人来说效果不佳。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM