• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 828
  • Last Modified:

How to install a font along with installation of my application in C#?

I have developed an application with c# and I'm making a setup for it. I need to install a special font with my application. I found a code in Internet which I include it in Code part but it give me an error that it doesn't know FontInstall.
Would you please help me solve it or give me another way of doing the job.

Thanks in advance.
int Ret; 
int Res; 
string FontPath; 
const int WM_FONTCHANGE = 0x001D; 
const int HWND_BROADCAST = 0xffff; 
FontPath = WinFontDir + "\" + FontFileName; 
Ret = FontInstall.AddFontResource(FontPath); 
Res = FontInstall.SendMessage(HWND_BROADCAST, WM_FONTCHANGE, 0, 0); 
Ret = FontInstall.WriteProfileString("fonts", FontName + " (TrueType)", FontFileName);

Open in new window

1 Solution
Perhaps you can add the font as an resource to your project.
Éric MoreauSenior .Net ConsultantCommented:
You can include your font into your Setup Package if you have one and it will automatically be deployed.

Also have a look at http://www.emoreau.com/Entries/Articles/2007/10/Embedding-a-font-into-an-application.aspx
Elham_SeifAuthor Commented:
This simple sentence was my answer:
In the « File System », add the « Fonts Folder » and add your font files to it. Those fonts will automatically be deployed to the right folder

Featured Post

 [eBook] Windows Nano Server

Download this FREE eBook and learn all you need to get started with Windows Nano Server, including deployment options, remote management
and troubleshooting tips and tricks

Tackle projects and never again get stuck behind a technical roadblock.
Join Now