We help IT Professionals succeed at work.

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

Elham_Seif
Elham_Seif asked
on
Medium Priority
851 Views
Last Modified: 2013-11-07
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

Comment
Watch Question

Dirk HaestProject manager
CERTIFIED EXPERT

Commented:
Perhaps you can add the font as an resource to your project.
http://www.tek-tips.com/faqs.cfm?fid=4747
Senior .Net Consultant
CERTIFIED EXPERT
Top Expert 2016
Commented:
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

Not the solution you were looking for? Getting a personalized solution is easy.

Ask the Experts

Author

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
Access more of Experts Exchange with a free account
Thanks for using Experts Exchange.

Create a free account to continue.

Limited access with a free account allows you to:

  • View three pieces of content (articles, solutions, posts, and videos)
  • Ask the experts questions (counted toward content limit)
  • Customize your dashboard and profile

*This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

OR

Please enter a first name

Please enter a last name

8+ characters (letters, numbers, and a symbol)

By clicking, you agree to the Terms of Use and Privacy Policy.