Embed a font
If you want to embed a font into your Silverlight applications, add the font into your project:
Set the Build Action file property to embedded resource:
Use the following code snippet to use the font as a font source for your components:
Assembly ass = Assembly.GetExecutingAssembly();
Stream stream = ass.GetManifestResourceStream("EmbeddedResource.Font.pricedow.ttf");
this.test.FontSource = new FontSource(stream);
this.test.FontFamily = new FontFamily("Pricedown");
XAML looking something like:
<Grid x:Name="LayoutRoot" Background="White">
<Canvas>
<TextBlock x:Name="test" FontFamily="annifont.ttf#Annifont" Text="grand theft auto IV" FontSize="30"/>
</Canvas>
</Grid>
And the result:
