字体查找:FontName和PostScriptName [英] Font Lookup : FontName and PostScriptName

查看:1860
本文介绍了字体查找:FontName和PostScriptName的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个要求,我必须检查是否已经安装了给定的字体文件。从字体文件中,我提取了字体名称,字体系列名称和发布脚本名称。在Windows中,我必须检查 SOFTWARE\\Microsoft\\ Windows NT \\ CurrentVersion \\Fonts 中的注册表项。但我注意到,对于某些字体,注册表项具有字体名称,而对于某些字体(尤其是Adobe字体)则具有后脚本名称。

例如, comic.ttf 字体名称Comic Sans MSPost Script NameComicSansMs 的。注册表值适用于Comic Sans MS

但是对于其他一些字体,比如 MinionPro-Regular.otf (这是一个adobe文件),字体名称是Minion Pro Post Script Name是MinionPro-Regular,注册表值是MinionPro-Regular



管理字体查找的拇指规则是什么?它是否因字体类型而异??



任何帮助都将深受赞赏。



谢谢并且问候

解决方案

如果你有字体文件的名称,那么你可以快速检查 C:\ Windows \字体目录,看看文件是否已经存在。

如果我没记错的话,放在这个文件夹中的任何字体文件都会自动添加到注册表中,所以它是检查字体是否已安装的有效方法。

但是,如果您需要使用注册表,您可能会发现 EnumFontFamiliesEx [ ^ ]界面有用。


您需要使用Windows API EnumFontFamiliesEx 和其他相关的字体和文本函数。请参阅:

http ://msdn.microsoft.com/en-us/library/windows/desktop/dd162620%28v=vs.85%29.aspx [ ^ ]。



一些代码示例:

http://stackoverflow.com/questions/945547/how-can-i-get-a-list-of-installed-fonts-on-windows-using -unmanaged -c [ ^ ]。



-SA

I have a requirement wherein I have to check whether a given font file is already installed or not. From the font file, I have extracted the "Font Name", "Font Family Name" and "Post Script Name". In windows, I have to check for the registry entries in SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\\Fonts. But I have noticed that for some fonts the registry entries have "Font Name" and for some (especially Adobe Fonts) have "Post Script Name".
For example, comic.ttf has "Font Name" "Comic Sans MS" and "Post Script Name" "ComicSansMs". The registry value is for "Comic Sans MS".
But for some other fonts, like MinionPro-Regular.otf(which is an adobe file), the "Font Name" is "Minion Pro" the "Post Script Name" is "MinionPro-Regular" and the registry value is for "MinionPro-Regular".

What is the the thumb rule governing the Font lookup? Does it vary from font type to font type?

Any help will be deeply appreciated.

Thanks And Regards

解决方案

If you have the name of the font file, then you could just perform a quick check against the C:\Windows\Fonts directory and see if the file already exists there.
If I remember correctly, any font file placed in this folder will automatically get added to the registry so it is a valid way to check if the font is installed.
However, if you need to use the registry, you might find the EnumFontFamiliesEx[^] interface helpful.


You need to use the Windows API EnumFontFamiliesEx and other related "Font and Text Functions". Please see:
http://msdn.microsoft.com/en-us/library/windows/desktop/dd162620%28v=vs.85%29.aspx[^].

Some code sample:
http://stackoverflow.com/questions/945547/how-can-i-get-a-list-of-installed-fonts-on-windows-using-unmanaged-c[^].

—SA


这篇关于字体查找:FontName和PostScriptName的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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