Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

using custom font in xaml

I need to use custom font in xaml (c#). The font is not installed on the computer.

If the font is in the application installed folder,then i can use it even if it is not installed (/Fonts/New12.ttf#New12)

My problem is that the custom font is been created on the local computer and can't be in the installed folder.

The problem is that i can't copy the ttf file to the application installed folder , and i don't know how to use custom font that is not on the application installed folder

Is anyone have an idea ?

like image 639
Assaf Dar Avatar asked Feb 18 '26 21:02

Assaf Dar


1 Answers

Add the font to your project, change its Build Action to Content. Then just reference it inline or as part of a Style or BasedOn value like;

<TextBlock FontFamily="/Fonts/New12.ttf#New12" Text="Check out my awesome font!" />

That should do it for you.

like image 124
Chris W. Avatar answered Feb 21 '26 15:02

Chris W.



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!