Friday 27 April 2012

Embedding custom font or Dynamics CRM font in Silverlight 4.0

When you need to use a custom font/Dynamics CRM font which is not available in your Silverlight applications then just “embed” it as shown in this blog.

First of all get the font file (.ttf), if font is already exists at your system then you could find it at “C:\Windows\Font”; otherwise download that font file from the internet.

Here I’ve created simple Silverlight application having a label with Verdana fontfamily, as shown below.


Now, I want to change FontFamily for Label1 from “Verdana” to “Segoe UI” which is not available in Silverlight fonfamily.

Follow the below steps.

· Right click on Project.

· Select Add -> Existing Item.

· Select “segoeui.ttf” file.

· Click on Add.


Now, you could see “segoe.ttf” file in solution explorer.


Replace, FontFamily="Verdana" with FontFamily="segoeui.ttf#Segoe UI" in above code, Where “segoeui.ttf” is font file name that we recently imported in our application, “Segoe UI” is the name of the font available in that file and “#” works as delimiter. That’s it we are done.


1 comment: