Installing a font on a client machine
-
02-07-2019 - |
Question
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)?
Solution
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.
OTHER TIPS
For me, Timothy Carter had the answer mostly right:
"right click on the File System on Target Machine, Add Special Folder -> Fonts Folder, then place your font file there."
But that was not enough. The Fonts didn't actually get installed as system Fonts.
To install the fonts, I had to visit the Properties for each font file and change Register=vsdrfDoNoRegister to Register=vsdrfFont. After that the Setup file I generated would also install the font!
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.
I'm using InnoSetup to deliver my VS applications. It allows you to install fonts from your system to the client system.
I never tested in Windows 7 or Vista (probably you'll have some permission issues).
Remember that not all the fonts are freely distributable.