Custom Fonts
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.
- I added the font that I downloaded to my project
- I marked BuildAction = Resource in the properties tab for the font file
- Then I refer to that Font just like any other resource in the FontFamily property
- 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"/>
Great resource for fonts. Thanks.
eWreckers
March 30, 2008 at 8:22 am
Download Free Font for Windows and Mac.
Free Font
April 3, 2008 at 3:32 am
Thanks for this, was just what i was looking for :¬)
Tim Hustler
April 3, 2008 at 12:59 pm