Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I Embed a font with my C# application? (using Visual Studio 2005)

Tags:

c#

fonts

What is the best way to embed a truetype font within the application i'm developing? Basically i want to make sure a particular font is available to my application when installed on another machine. I have the *.ttf font file and just need a way of embedding it or automatically installing it when the application is run.

Do i need to set the installation program to install the font during installation or can i dynamically load the font during runtime of the application? In fact both would be nice to know.

The application is being developed in C# using .NET 2.0.

like image 850
Gary Willoughby Avatar asked Apr 07 '09 18:04

Gary Willoughby


People also ask

How do you embed the font?

Embed fonts in a document or presentation Open the file you want to embed fonts in. On the application (PowerPoint or Word) menu, select Preferences. In the dialog box, under Output and Sharing, select Save. Under Font Embedding, select Embed fonts in the file.

What does it mean for a font to be embedded?

Font embedding is the inclusion of font files inside an electronic document. Keep in mind the following: You may not have the printing rights for a font. Some fonts are screen fonts meaning they cannot be used for print and you will not be able to embed them in your PDF.


1 Answers

This blog post should help you.

Basically you add the font as an embedded resource then load it into a PrivateFontCollection object.

like image 145
dommer Avatar answered Oct 06 '22 17:10

dommer