Sunday, December 14, 2008 10:04 AM
In a previous post I talked about how when you install the Silverlight runtime on the client it only installs with a subset of fonts, and if you want to use a font that isn’t part of the default package you have to add it to your project.
Now you can easily do this by adding the font file by going Add>Existing Item, but I stumbled on a built in Font Manager feature of Blend that makes this much easier.
Go to Tools and click Font Manager…
This brings up the font manager dialog, which gives you a font browser to select the fonts you want included in your application.
When you click OK, Blend will add a Fonts folder in your project and place all font files within it.
If you set the font for an element in Blend from the properties window, you’ll now see that your added font will show up in the list with a different icon, and when you hover over it with your mouse you’ll get a tool tip saying “Font added to project’.
Now by default it will set the build action for the font file to ‘BlendEmbeddedFont’. From a ‘running your application’ point of view, I didn’t see any difference between that and setting the build action to ‘Resource’ In fact, regardless of whether its an embedded font or a resource for the build action, you still need to include the path to the actual file within your XAML.
One final note on the font import tool: Some fonts that you select will enable the bottom section of the dialog…
This allows you to select only those parts that you require for your application (i.e. only lowercase, uppercase, numbers, etc.). Because keeping the size of the package as small as possible is a key facet to Silverlight development, this is a great feature to ensure that you only send down the parts of a font that you actually need. For example, if you had an Algerian calculator which will only need numbers and not letters, you can specify only numbers get sent to the client.
So some notes on another way to skin the font cat within Silverlight.
D