Desperately Seeking Love of Sophie

Custom Fonts

with 3 comments

I wanted to use some custom fonts in application. Karen sent me this link to some free custom fonts. I downloaded one of them to use in my application. It took me a while to figure out the exact syntax to get it working so I thought I would write a short blog post.

  1. I added the font that I downloaded to my project
  2. I marked BuildAction = Resource in the properties tab for the font file
  3. Then I refer to  that Font just like any other resource in the FontFamily property
    1. so here is the part i was stuck for a while. The FontFamily property should take a value “<Uri to Font file>#<Font Family Name>. I was having hard time figuring out what the font family would be for downloaded font. Mark told me that I should just double click on the font and then it opens up in FontViewer and shows the name of the font.

So the only thing in code changes was

<TextBox
            Grid.Column="1" Grid.Row="1" Margin="40,10,120,10"
            Text="TextBox"
            x:Name="txtSearch"
            Background="{StaticResource TextBoxBackgroundBrush}"
            FontFamily="Fontin-Bold.ttf#Fontin" FontSize="20"/>

Written by Vivek

March 29, 2008 at 12:05 am

Posted in Professional, Software

Tagged with

3 Responses

Subscribe to comments with RSS.

  1. Great resource for fonts. Thanks.

    eWreckers

    March 30, 2008 at 8:22 am

  2. Download Free Font for Windows and Mac.

    Free Font

    April 3, 2008 at 3:32 am

  3. Thanks for this, was just what i was looking for :¬)

    Tim Hustler

    April 3, 2008 at 12:59 pm


Leave a Reply