views:

754

answers:

3

I'm using Visual Studio 2008 and the built-in installation tools for a C# client application. How can I use this installer to install a font on the client machine (if it's not already there)?

A: 

Take a look at this article.

http://www.atakala.com/Browser/Item.aspx?user_id=amos&dict_id=83

The most important call is the AddFontResource Win32 API call altough the described sequence of operations must be respected for you to have a working font setup in the system.

http://msdn.microsoft.com/en-us/library/ms534231(VS.85).aspx

The AddFontResource function adds the font resource from the specified file to the system font table. The font can subsequently be used for text output by any application.

smink
This doesn't install the font so it's available to the system constantly. It only loads it into the current session, so it'll be lost when the system is rebooted. For a font to be installed properly it needs to be put in the system font folder and registered in the registry, in addition to this.
jfs
+5  A: 

In VS2005 (so I assume 2008 as well), right click on the File System on Target Machine, Add Special Folder -> Fonts Folder, then place your font file there.

Timothy Carter
A: 

If its a web application, there exists a particular CSS module that enables web fonts (dynamically downloaded fonts at runtime).

http://www.w3.org/TR/css3-webfonts/

I think the only browser to support it right now is Safari, though. =\

treefrog