Embed font in Silverlight using StreamResourceInfo in Code behind

To embed fonts, you add the font file (typically, a file with the extension .ttf) to your application and set Build Action to Resource.

StreamResourceInfo sri = Application. GetResourceStream( 
  new Uri("FontTest;component/Myw3Font. ttf" , UriKind. Relative)) ; 
lbl.FontSource = new FontSource(sri.Stream) ; 
lbl.FontFamily = new FontFamily("FFFont") ;

Enjoyed this post? Share it!


Leave a comment

Your email address will not be published.