获取字体列表(Win32) [英] Get list of fonts (Win32)

查看:72
本文介绍了获取字体列表(Win32)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想制作一个组合框,其中列出了计算机的所有已安装字体.我不确定如何做到这一点.我需要访问注册表来获取此信息吗?谢谢

I want to make a combo box with all of the computer's installed fonts enumerated in it. I'm not sure how this is done. Do I need to access the registry to get this? Thanks

推荐答案

您应该使用Win32 API函数 EnumFontFamExProc .对于EnumFontFamiliesEx找到的每种字体,都会对回调函数调用一次.

You should use the Win32 API function EnumFontFamiliesEx. You call that function, passing a callback function matching the type of EnumFontFamExProc. The callback function is called once for every font found by EnumFontFamiliesEx.

我建议使用unicode版本(EnumFontFamiliesExW),因为我已经看到ascii版本(EnumFontFamiliesExA)对于东亚语言字体显示出一些非常奇怪的行为.

I'd recommend using the unicode version (EnumFontFamiliesExW), as I've seen the ascii version (EnumFontFamiliesExA) display some very weird behaviour for East Asian language fonts.

链接的文章具有示例代码.

The linked articles have example code.

这篇关于获取字体列表(Win32)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆