Embed / use custom font in Windows 8 Store apps #win8dev #winrt

I was supposed to blog earlier but forgot. Saw a question on Stackoverflow and thought.. now is the time. So how does one embed fonts ?
Well just include them in project as Content files.

How do you use them.. here is how

<ComboBox x:Name="cbFont" Width="230" Margin="0, 10, 0, 0" Foreground="Black" Background="Gray" SelectionChanged="cbFont_SelectionChanged">
     <ComboBoxItem Content="12:34" FontFamily="Assets/Fonts/akka.ttf#Akka" />
     <ComboBoxItem Content="12:34" FontFamily="Assets/Fonts/alghorie neue.ttf#alghorie neue" />
     <ComboBoxItem Content="12:34" FontFamily="Assets/Fonts/Alpha Mutation.ttf#Alpha Mutation" />
     <ComboBoxItem Content="12:34" FontFamily="Assets/Fonts/AlphaFlowers.ttf#AlphaFlowers" />
     <ComboBoxItem Content="12:34" FontFamily="Assets/Fonts/AMSTRG__.TTF#Ams Trame" />
     <ComboBoxItem Content="12:34" FontFamily="Assets/Fonts/ARCADE_I.TTF#Arcade Interlaced" />
     <ComboBoxItem Content="12:34" FontFamily="Assets/Fonts/ARCADE_R.TTF#Arcade Rounded" />
</ComboBox>

You dont have to use combo box you can use anything.. i use it with TextBlock etc as well. Just remember. After the font file name, you need to put the font name itself. Thats all

About these ads

One thought on “Embed / use custom font in Windows 8 Store apps #win8dev #winrt

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Connecting to %s