Friday, September 7, 2012

Windows 8: Use custom fonts

For a Windows 8 app I’m building, I wanted to use a custom font. It took me some time to figure out how to get this working.

So here are the steps:

  1. Add the font file to your project.
  2. Change the Build Action to Content.
  3. Specify the FontFamily using the format: /<path to font file>/<font file>#<font name>

If you don’t know the font name, double click on the font file:


A sample:

<TextBlock FontFamily="/Assets/Fonts/Bauhaus93.TTF#Bauhaus 93"/>


No comments: