10
Dec
08

How to use custom fonts in Silverlight 2

Tim Heuer goes into detail regarding how to use custom fonts in Silverlight 2 (check it out here). This is a snippet from his blog:

“When we set that in the FontFamily to a file, Silverlight essentially creates the downloader for us in an efficient manner. The font file is requested based on the URI provided and downloaded via a GET request. Once downloaded it parses out the second part (the “#”) to look within that font file for the named font. So essentially the format is:

<file>#<named-font>

where # is the delimiter in this format. That’s it, you are done. No script needed. If you choose to package several font assets within your application you can put them in a single archive file as well and the same syntax would apply:

<TextBlock x:Name=”Header” FontFamily=”segoeB.zip#Segoe Bold” />

The same execution happens. Silverlight gets the archive file and then looks at the font file contents in the archive to find the first named font to use. The archive doesn’t have to only have font files either…which is cool at times.”


0 Responses to “How to use custom fonts in Silverlight 2”



  1. Leave a Comment

Leave a comment