Before I begin, obfuscate is one of my least favorite words. It just sounds pretentious whenever it rolls off the tongue. Moving on…over the past couple days I have been struggling with embedding a font into my Silverlight project. There are a number of tutorials out there on how to embed fonts (Tim Hauer has a great screencast on it). However thorough and easy to follow the tutorials are, embedding a font is still buggy, especially when working on a large scale project. There are two things wrong:
- The <FontFamily> tag is not recognized as valid by Visual Studio. The prime location to define an application wide font is in the App.xaml file. In this file, you can data bind the FontFamily anywhere in your application. Ignore the Visual Studio error and still place the <FontFamily> declaration in the App.xaml.
- The Font location is relative to where the first call is made from. If you have a control nested in a subdirecty that calls the font family, you will need to tweak the location in the App.xaml. This was a great find by my colleagues Stephen Rettinger and Lisa Smith.
As for obfuscating (saying it like Robin Leech) the font…why would you do this?
First, if you obfuscate the font, then the license like that of Adobe Acrobat. It’s considered truly embedded. If you include the ttf file in the xap it’s considered redistribution and the cost of a license is sky high. (Note: I am not a lawyer, this is strictly my understanding of font licensing).
Secondly you don’t have to worry about someone extracting the font file from the xap and installing it on their computer. Obfuscated fonts are not installable and can possibly be a subset of the original font.
Many thanks go out to Stephen Rettinger for showing me this. He has a really nice step by step on how to do this. Hopefully he gets a blog up to post the tutorial.
Links on how to embed fonts
http://timheuer.com/blog/archive/2008/03/10/embedding-fonts-in-silverlight-2.aspx
http://www.jeffblankenburg.com/2008/11/tutorial-9-embedding-fonts-in.aspx



November 18th, 2008 at 9:41 pm
[...] I have been struggling with embedding a font into my Silverlight project. There are…(read more) Posted in News | Leave a [...]
November 19th, 2008 at 2:21 am
[...] Corey Schumann on Embedding and Obfuscating fonts [...]
November 19th, 2008 at 6:39 am
[...] Embedding and Obfuscating Fonts (Corey Schuman) [...]
March 3rd, 2009 at 4:43 am
Hello webmaster
I would like to share with you a link to your site
write me here preonrelt@mail.ru
May 24th, 2009 at 3:11 pm
Ай яй яй. Спёрли тему у Давыдова))
здесь видел ет gamebulletin.ru
June 15th, 2009 at 11:54 am
I did a lot of research trying to figure out how to legally obfuscate and include fonts in a Silverlight project. Because I was unable to find a step by step guide in one place I am posting it here.
1. Create Microsoft Word Document
2. Change the font to the desired font type
3. Print to XPS file
4. Change the XPS file extension to .zip
5. Open zip file and navigate to Fonts directory (eg: somezipfile.zip\Documents\1\Resources\Fonts)
6. Copy the ODTTF file (***DO NOT CHANGE THE NAME OF THE ODTTF FILE***)
7. If more than one font is required you can add several to a zip file
8. In the Silverlight project (not the associated web project) include the ODTTF, or zip file using “Add” -> “Existing Item”
9. Click on the newly added file and go to Properties
10. Change the “Build Action” to Resource
11. In the Xaml file you can now add controls with the FontFamily set, see the two examples below
12. **Compile**
13. You may need to launch the site in the debugger to see the fonts for the first time, but after that they should show up in the designer.
Code examples:
June 15th, 2009 at 11:57 am
Code examples did not post… trying again, but showing only the FontFamily tag.
FontFamily=”DA09FD01-347E-4FF6-9877-23AED4599FCE.odttf#Segoe UI”
FontFamily=”fonts.zip#Segoe UI”