Get list of fonts (Win32)

旧时模样 提交于 2021-02-07 13:43:31

问题


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


回答1:


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.

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.




回答2:


The winapi way of doing it is using EnumFontFamiliesEx function. You should pass a filled structure with default param DEFAULT_CHARSET to list all installed fonts.

See MSDN to get more information.



来源:https://stackoverflow.com/questions/2702157/get-list-of-fonts-win32

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!