简体   繁体   中英

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. However, even after including , I can't call 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).

or take a look at Christophe Wille's WinRT snippets project on GitHub

EnumFontFamilies() is a winapi function. 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. 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. 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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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