Silverlight Font Support
*Silverlight supports a collection of common fonts out of the box. These fonts are Arial, Arial Black, Comic Sans, Courier New, Georgia, Lucida Grande, Times New Roman, Trebuchet, and Verdana, Silverlight supports a collection of common fonts out of the box. These fonts are Arial, Arial Black, Comic Sans, Courier New, Georgia, Lucida Grande, Times New Roman, Trebuchet, and Verdana,
So what if an application requires another font? Silverlight also supports custom fonts, and the steps to use a custom font are as follows:
*Add the font file (.ttf) into your Silverlight Project by selecting Project/Add Existing Item.
*Set the Build Action of the .ttf file to Resource
*Note the Font Name (the embedded name in the font file). If you are not sure what this is, double-click the .ttf file in Windows Explorer and the Font Name will be displayed at the top of the Font Viewer.
*Inside your XAML element (TextBlock, TextBox, etc), set the FontFamily in the format "FontFile#FontName" - For example, to set to a Font named Times Square inside a font file named TIMES_SQ.TTF, you would use:
{TextBlock FontFamily="TIMES_SQ.TTF#Times Square" FontSize="32" TextWrapping="Wrap" Text="This TextBlock is using a Custom, Embedded Font." /}
So what if an application requires another font? Silverlight also supports custom fonts, and the steps to use a custom font are as follows:
*Add the font file (.ttf) into your Silverlight Project by selecting Project/Add Existing Item.
*Set the Build Action of the .ttf file to Resource
*Note the Font Name (the embedded name in the font file). If you are not sure what this is, double-click the .ttf file in Windows Explorer and the Font Name will be displayed at the top of the Font Viewer.
*Inside your XAML element (TextBlock, TextBox, etc), set the FontFamily in the format "FontFile#FontName" - For example, to set to a Font named Times Square inside a font file named TIMES_SQ.TTF, you would use:
{TextBlock FontFamily="TIMES_SQ.TTF#Times Square" FontSize="32" TextWrapping="Wrap" Text="This TextBlock is using a Custom, Embedded Font." /}
Comments
Post a Comment