I have a default Visual Studio project for .NET MAUI Blazor app (building for Windows x64). I've tried 2 different ways of changing the font.
In MauiProgram.cs there is a configuration of fonts
ConfigureFonts
. I've added a new font Montserrat-Regular.ttf to the Resources/Fonts directory and registered my font there. Using this font with its new alias didn't work though.Following these instructions I've added the same file to
wwwroot/css
and this towwwroot/css/app.css
@font-face {
font-family: Montserrat;
src: url('Montserrat-Regular.ttf') format('truetype');
}
html, body {
font-family: Montserrat;
}
It doesn't work either. Even though changing font-family to a basic font like Arial or Times-New-Roman does in fact work.