确定TTF字体文件名(Determining TTF Font File Name)

如果我有一个.NET Font对象,有没有办法以编程方式确定它创建的C:\ Windows \ Fonts目录中的哪个ttf文件?

If I have a .NET Font object, is there a way to programmatically determine which ttf file in the C:\Windows\Fonts directory it was created with?

最满意答案

这篇有用的文章建议通过查看注册表项

HKLM\Software\Microsoft\Windows NT\CurrentVersion\Fonts

您将获得字体名称,文件名对的列表。 打开所述注册表项,遍历名称直到找到匹配项,然后该值包含文件名(没有路径)。

This helpful article suggests that by looking at registry key

HKLM\Software\Microsoft\Windows NT\CurrentVersion\Fonts

You'll get a list of fontname, filename pairs. Open said registry key, iterate through the names until you find a match, then the value contains the filename (without a path).

更多推荐