Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Distribute fonts for application
Message
General information
Forum:
ASP.NET
Category:
Deployments
Miscellaneous
Thread ID:
00735731
Message ID:
00735879
Views:
8
One approach you can do is to embed your fonts into your application. However, you won't be able to do this if the font requires licensing.

.NET provides the PrivateFontCollection class which will allow you to
"embed" the font into your application thereby obviating the need to
distribute or install the font on the client's machine.

To embed a font using VS.NET add the font to the solution and ensure that
its build action is set to "embedded resource" in the properties for the
font.

Then, at some suitable place in the code, possibly the Form.Load event
handler or the Form constructor, load the font like so:
PrivateFontCollection pfc = new PrivateFontCollection();

private void Form1_Load(object sender, System.EventArgs e)
{
   Stream fontStream =
this.GetType().Assembly.GetManifestResourceStream("<application>.<font
filename>"); // for example. "MyApplication.lucidasans.ttf"


   byte[] fontdata = new byte[fontStream.Length];
   fontStream.Read(fontdata,0,(int)fontStream.Length);
   fontStream.Close();
   unsafe
   {
    fixed(byte * pFontData = fontdata)
    {
     pfc.AddMemoryFont((System.IntPtr)pFontData,fontdata.Length);
    }
   }
}
>Hello!
>
>I use InstallShield program to distribute my application. But I do not how register fonts. I want that after setup my program, restart windows, windows auto install my fonts.
>Please tell me how I do that.
>
>Thank!
-----------------------------------------

Cathi Gero, CPA
Prenia Software & Consulting Services
Microsoft C# / .NET MVP
Mere Mortals for .NET MVP
cgero@prenia.com
www.prenia.com
Weblog: blogs.prenia.com/cathi
Previous
Reply
Map
View

Click here to load this message in the networking platform