Install Type 1 Font in VS 2010 Setup Project
See the question and my original answer on StackOverflowHere 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
using System;
using System.Collections;
using System.ComponentModel;
using System.Configuration.Install;
using System.IO;
using System.Runtime.InteropServices;
namespace InstallType1Font
{
[RunInstaller(true)]
public partial class Installer1 : Installer
{
public Installer1()
{
InitializeComponent();
}
[System.Security.Permissions.SecurityPermission(System.Security.Permissions.SecurityAction.Demand)]
public override void Install(IDictionary stateSaver)
{
base.Install(stateSaver);
}
[System.Security.Permissions.SecurityPermission(System.Security.Permissions.SecurityAction.Demand)]
public override void Commit(IDictionary savedState)
{
base.Commit(savedState);
// here, you'll have to determine the proper path
string path = @"c:\Windows\Fonts\MyFont.pfm";
if (File.Exists(path))
{
InstallFontFile(IntPtr.Zero, path, 0);
}
}
[DllImport("fontext.dll", CharSet = CharSet.Auto)]
private static extern void InstallFontFile(IntPtr hwnd, string filePath, int flags);
[System.Security.Permissions.SecurityPermission(System.Security.Permissions.SecurityAction.Demand)]
public override void Rollback(IDictionary savedState)
{
base.Rollback(savedState);
}
[System.Security.Permissions.SecurityPermission(System.Security.Permissions.SecurityAction.Demand)]
public override void Uninstall(IDictionary savedState)
{
base.Uninstall(savedState);
}
}
}
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.