Struggling to get custom fonts working #14298
-
I am trying to include a custom font in my Avalonia project using the instructions here: https://docs.avaloniaui.net/docs/guides/styles-and-resources/how-to-use-fonts#:~:text=In%20your%20Avalonia%20application%2C%20open,reference%20it%20in%20your%20application. In /Assets/Fonts I have Montserrat.ttf.
I then try and use the font like so:
However, I get the error:
If I refer to the font directly with:
It works fine. What am I doing wrong? Andy |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 2 replies
-
I believe you need to add your project name here: <Application.Resources>
! <FontFamily x:Key="Montserrat">avares://[MyProject]/Assets/Fonts#Montserrat</FontFamily>
</Application.Resources> |
Beta Was this translation helpful? Give feedback.
I believe you need to add your project name here:
<Application.Resources> ! <FontFamily x:Key="Montserrat">avares://[MyProject]/Assets/Fonts#Montserrat</FontFamily> </Application.Resources>