Archive for the ‘Windows Phone 8’ Category

Embedding OTF Fonts in Windows Phone 8

Friday, January 3rd, 2014

Now I don’t think there is a difference between between TTF and OTF fonts when it comes to Windows Dev. I do how ever think that the way the fonts them selves are set up, are different.

A lot of people as well as my self have had trouble with embedding OTF fonts. The problem ended up being the name of the font inside the font file. The Windows OS font does not show you all of the variations on the name.

How to embed a font you are having trouble with:

Code:

Settings:

MyFontFileNameExtraBold.otf needs to have 2 properties set the “Build Action” which should be resource for WinPhone 8 and the “Copy to Output Directory” which should be Copy if newer. See image bellow.

vsProperties

The font name problem

As you can see in the above FontFamily prams for custom fonts its made up of the path to the font followed by a hash then the font name. Now for some reason it is not the font name that creates the problem. first you need a font viewer that  shows all the names.

I use: http://us.fontviewer.de/download.html

Open up your font in this program. You will see lots of info for the font. In my case I needed to use the “Preferred Family” name to replace the “My Font Name” in the path above. but if that does not work for you try one of the others. See image bellow:

font_tool