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.

image

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.

clip_image004

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

clip_image006

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.

image

2 comments:

  1. can you please provide this code separately because it is difficult for me to choose it from multiple locations ...

    CRM customer relationship management
    Lead Management Software

    ReplyDelete
  2. Hi,

    What type of code do you want separately?

    ReplyDelete