Font Embedding in Silverlight 2 beta 2
June 10. 2008 Posted in:
I added a font to my SilverNibbles game this weekend as part of converting to beta 2. You can see it in action here.
The way to do this is relatively straightforward:
Add your font to the project. The build action should be Resource. You do not need to copy to the output directory. Visual Studio will put it into your DLL file at compile time. (n.b. If you choose Content instead, it will go into your XAP file which also works, but apparently loading fonts from the XAP will not be supported after beta 2 so this method is not recommended)
Now whenever you need to use the font, simply use the syntax
FontFamily="Font Name.ttf#FontName"
.
And that is all there is to it.