I’m creating a WPF application where I need to use custom fonts. A created a font resource library as described here http://msdn.microsoft.com/en-us/library/ms753303.aspx. An example shows how to set a font family in XAML:
<Run FontFamily="/FontLibrary;Component/#Kootenay" FontSize="36">
ABCDEFGHIJKLMNOPQRSTUVWXYZ
</Run>
How do I set a font family in the code?
Assign a Name to your run and then construct the FontFamily with the URI constructor:
Xaml:
Code behind: