I use some custom fonts in my C # WPF.NET 4.0 application (Open Sans and FontAwesome in particular) with Visual Studio 2013.
I have:
- Added FontAwesome.otf and OpenSans-Regular.ttf to my project (not as a link) under / Fonts.
- Make sure that both fonts are set to Resource.
- Both fonts are installed locally (Windows 8.1).
- New styles have been created in my resource dictionary (which contains many other parts, so I'm sure it works).
- Restart VS2013.
Here is a snippet of the style that I created in my resource dictionary:
<Style x:Key="OpenSans">
<Setter Property="TextElement.FontFamily" Value="pack://application:,,,/Fonts/#Open Sans" />
</Style>
<Style x:Key="FontAwesome">
<Setter Property="TextElement.FontFamily" Value="pack://application:,,,/Fonts/#FontAwesome" />
</Style>
Now, in the new user control that I created to check the constructor, and these fonts were included correctly, I wrote the following XAML:
<TextBlock Style="{StaticResource FontAwesome}" FontSize="64" Text="" />
<TextBlock Style="{StaticResource OpenSans}" FontSize="48" Text="the quick brown fox jumped over the lazy dog." />
<TextBlock FontFamily="Open Sans" FontSize="48" Text="the quick brown fox jumped over the lazy dog." />
FontAwesome FoneAwesome.
OpenSans , , Open Sans.
Open Sans FontFamily , Open Sans ().
, , , . , , FontAwesome , Open Sans. , , , FontAwesome Open-Type, Open Sans - True Type.
- , - , , , OTF TTF VS Designer?