#817 – Embedding a Font into Your Application

When you specify fonts that are to be used with your application, you typically specify font attributes, like FontFamily, and then let Windows look for a previously installed font that matches what you’re asking for.

If you have a non-standard font that you want to use and you have a copy of the TrueType (.ttf) file for the font, you can embed the font in your application, to make sure that your font gets used at run-time.

To embed a font, do the following:

Copy the font (.ttf file) into your project directory.  Add the font to your project by right-clicking on the project and selecting Add Existing Item.

817-001

Set the filter to All Files, find and select the .ttf file, and click Add.

817-002

817-003

Set the Build Action for the font to Resource.

817-004

Finally, set the FontFamily property to the font’s name, prefixing the name with “./#”.

817-004B

817-005

Advertisements

About Sean
Software developer in the Twin Cities area, passionate about software development and sailing.

One Response to #817 – Embedding a Font into Your Application

  1. Pingback: Dew Drop – May 10, 2013 (#1,545) | Alvin Ashcraft's Morning Dew

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: