从给定的字体名称获取字体文件 [英] Get fontfile from a given font name

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

问题描述

我正在尝试获取与给定系统字体相对应的文件,例如:在我的系统中,我具有字体"Algerian"和相应的文件"C:\ Windows \ Fonts \ ALGER.TTF",以及该字体Batang,文件为"C:\ Windows \ Fonts \ batang.ttc".

I'm trying to get the file corresponding to a given system font, e.g: In my system I have the font "Algerian" with the corresponding file "C:\Windows\Fonts\ALGER.TTF", and the font Batang, with the file "C:\Windows\Fonts\batang.ttc".

我看过几篇文章,说我可以通过迭代fonts文件夹并从文件头中提取字体名称来做到这一点(如下所述: http://www.codeguru.com/cpp/gm/gdi/fonthandlinganddetection/article.php/c3659/),但这似乎效率不高且有点复杂.

I've seen a couple of posts saying that I can do this by iterating the fonts folder and extracting the font name from the file header (as explained here: http://www.codeguru.com/cpp/g-m/gdi/fonthandlinganddetection/article.php/c3659/), but this seems inefficient and a bit complicated.

有更好的方法吗?还是必须遍历整个目录?

Is there a better way to do it? or do I have to iterate the whole directory?

谢谢

推荐答案

在HKEY_LOCAL_MACHINE \ SOFTWARE \ Microsoft \ Windows NT \ CurrentVersion \ Fonts中,您可以获得带有文件名的字体列表

In HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Fonts you got the list of font with their filename

这篇关于从给定的字体名称获取字体文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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