问题
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)?
回答1:
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.
回答2:
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!
回答3:
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.
回答4:
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.
来源:https://stackoverflow.com/questions/126594/installing-a-font-on-a-client-machine