在 VS 2010 安装项目中安装 Type 1 字体
我正在尝试使用 Visual Studio 2010 安装项目将一组 Type 1 字体打包到 MSI 文件中,以便于安装。
我已将安装项目配置为将所有 PFM 和 PFB 文件放入 Fonts 文件夹中,将所有 PFM 文件设置为 vsdrfFont
并修复了此处提到的命名问题:
http://cjwdev.wordpress.com/2011/03/14/installing-non-truetype-fonts-with-visual-studio-installer/
但是,这不适用于类型 1 字体。
Type 1 字体文件已安装,但该字体仍然无法识别,并且不会出现在 Fonts
窗口中。
如果手动安装,Type 1 字体将在 HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Type 1 Installer\Type 1 Fonts
下注册并正常工作。
如何通过设置项目获得相同的结果?
I'm trying use a Visual Studio 2010 setup project to package a set of Type 1 fonts into a MSI file for easy installation.
I've configured my setup project to place all the PFM and PFB files in the Fonts folder, set all the PFM files to vsdrfFont
and fixed the naming issue mentioned here:
http://cjwdev.wordpress.com/2011/03/14/installing-non-truetype-fonts-with-visual-studio-installer/
However, this isn't working for Type 1 fonts.
The Type 1 font files are installed but the font is still not recognized and doesn't appear in the Fonts
window.
If installed manually, Type 1 fonts are registered under HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Type 1 Installer\Type 1 Fonts
and work fine.
How can the same result be achieved with a setup project?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
要安装 Type 1 字体,您需要执行以下操作:
在“Type 1 Fonts”下注册字体标题'
SOFTWARE\Microsoft\Windows NT\CurrentVersion\Type 1 Installer\Type 1 Fonts
字体标题是必需的,而不是提供将此信息发送给安装程序,以下代码片段将允许您从 PFM 读取字体标题。它基于从以下来源收集的信息:
http:// Partners.adobe.com/public/developer/en/font/5178.PFM.pdf
将 PFM 和 PFB 复制到 Windows 字体目录
根据此博客 http://www.atalasoft .com/cs/blogs/stevehawley/archive/2008/08/25/getting-the-fonts-folder.aspx正确的方法获取windows字体文件夹如下:
调用AddFontResource方法
最后调用AddFontResource方法,参数lpFilename由pfm和pfb文件组成,以竖线“|”分隔。 。就我而言,我将完整路径放入似乎有效的 Windows 字体文件夹中。调用 AddFontResource 后,您需要使用 WM.FONTCHANGE (0x001D) 参数调用 PostMessage 来通知其他窗口更改。
To install Type 1 fonts you need to do the following:
Register the font title under 'Type 1 Fonts'
SOFTWARE\Microsoft\Windows NT\CurrentVersion\Type 1 Installer\Type 1 Fonts
The Font Title is required, rather than providing this to the installer, the following code snippet will allow you to read the font title from the PFM. It is based on information gathered from the following source:
http://partners.adobe.com/public/developer/en/font/5178.PFM.pdf
Copy both the PFM and the PFB to the windows fonts directory
According to this blog http://www.atalasoft.com/cs/blogs/stevehawley/archive/2008/08/25/getting-the-fonts-folder.aspx the right way to get the windows fonts folder is as follows:
Call the AddFontResource method
Finally, the method AddFontResource should be called, the parameter lpFilename should be made up of the pfm and pfb files separated by the pipe character '|'. In my case I put the full path to the windows fonts folder which seemed to work. After calling AddFontResource you need to call PostMessage with a parameter of WM.FONTCHANGE (0x001D) to inform other windows of the change.
这是涉及 MSI 自定义操作的解决方案。我使用 C# 编写,但用户可以使用任何能够调用 DLL 的其他语言。以下是 C# 教程链接:演练:创建自定义操作
作为据我所知,
InstallFontFile
没有文档记录,但允许永久安装字体。使用此功能需要您自担风险。注意:您仍然需要修改 .MSI 以确保字体文件具有您提供的链接中所述的 FontTitle。
Here is a solution that involves an MSI custom action. I have written in using C#, but any other language capable of calling a DLL can be user. Here is a tutorial link for C#: Walkthrough: Creating a Custom Action
As far as I know,
InstallFontFile
is undocumented, but allows to install the font permanently. Use this at your own risk.Note: you still need to modify the .MSI to ensure the Fonts file have a FontTitle as described in the link you gave.