gpt4 book ai didi

c++ - 如何使用非托管 C++ 在 Windows 上获取已安装字体的列表?

转载 作者:可可西里 更新时间:2023-11-01 11:15:12 24 4
gpt4 key购买 nike

我进行了一些探索,到目前为止我已经找到了 EnumFontFamiliesEx(...)。但是,看起来此函数用于返回给定字体(例如“Arial”)的所有字符集。

我一开始不太明白如何获取已安装字体的列表。任何帮助/建议将不胜感激。

提前谢谢你。

最佳答案

你可以这样做:

LOGFONT lf;
lf.lfFaceName[0] = '\0';
lf.lfCharSet = DEFAULT_CHARSET;
HDC hDC = ::GetDC();
EnumFontFamiliesEx(hDC, &lf, (FONTENUMPROC)&EnumFontFamExProc, 0, 0);
ReleaseDC(hDC);

然后定义一个回调函数:

int CALLBACK EnumFontFamExProc(
ENUMLOGFONTEX *lpelfe,
NEWTEXTMETRICEX *lpntme,
DWORD FontType,
LPARAM lParam
)
{
AfxMessageBox(lpelfe->elfFullName);

//Return non--zero to continue enumeration
return 1;
}

关于c++ - 如何使用非托管 C++ 在 Windows 上获取已安装字体的列表?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/945547/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com