Reputation: 1999
I'm wonder if I use labels or textBoxes with font that I've on my PC but I can't be sure that every user will have it. Different font means different Text size... I mean wide and etc. Pretty hard to do pixel - perfect design. So am I need to embed this fonts into .exe file or what?
Or I've to choose font that I'm 100% sure everyone have?
Upvotes: 1
Views: 1460
Reputation: 19416
Here is the MSDN article on how to embed fonts into a WPF application in a variety of ways. If you cannot be sure the font you are using will be available on an end-user machine, use one of the approaches outlined in the article.
Upvotes: 3
Reputation: 176896
You need to add the font as resource and try it like this
Create a folder name Fonts and copy the font which you want and change the BuildAction to Resource
use it like as below
<Window.Resources>
<FontFamily x:Key="test" >/Fonts/#Pirulen</FontFamily>
</Window.Resources>
<TextBlock FontSize="25" HorizontalAlignment="Center"
FontFamily="{StaticResource test}">data</TextBlock>
Check full post : http://learnwpf.com/post/2006/05/14/How-do-I-use-a-custom-font-in-my-WPF-application.aspx
Upvotes: 2