I need my WPF app to use a true-type font for a different language. I have the font located in a folder called ‘fonts’ inside the project. The font I’m using is available for free download here
Since the font is installed in my system i first tried
FontFamily="FMBasuru"
I’ve read the post here and tried doing (this is the exact markup I’m using including font name)
<Window.Resources>
<Style x:Key="SinhalaFont">
<Setter Property="TextElement.FontFamily" Value="fonts/#FMBasuru"/>
</Style>
</Window.Resources>
…
<TextBlock Style="{DynamicResource SinhalaFont}">r</TextBlock>
…
I made sure that I’m using the correct font name instead of the font filename.
What could have I got wrong?
I tried your code with this
and it worked successfully.
Have you marked your font as ‘Resource’ in the Build Action? If you haven’t, do that now and try your code again.