✅ Font Families Support By Avalonia?
I have tried looking through the github repo and across google for a list of font families that the framework supports when doing
<Button FontFamily="Times New Roman"></Button>
but I cannot find it anywhere. Does anyone know where there is a legit list? Thanks33 Replies
Embed the font, don't directly set the font. The user must also have the font installed if you don't embed it
ok thanks for the advice, but what about the fonts that avalonia supports?
How To Use Custom Fonts | Avalonia Docs
Customizing your Avalonia application with unique fonts can add a distinctive look and feel. This guide will walk you through the process of integrating custom fonts into your Avalonia application.
Supports?
It can handle all of them
You embed the fonts as mentioned
what do you mean by embed them?
You copy them into your resources
of the csproj
And that will only use the font installed on your computer
so check your PCs installed fonts
If another user launches your application that does not have the font installed, it will use the default font for said application.
That is why it is recommended to add the font to resources within your app. That way the user does not need to have said font installed as it's loaded from memory.
ok so I have a font in
/Assets/Fonts/ShadowsIntoLight-Regular.ttf
. You said in the resources of the csproj so I'm assuming that is double clicking the project at the top of the solution explorer?
so here?A font in Assets folder, yes.
Must also be marked as a resource
Then follow the link I sent above
linking to avalonia docs
Resource or AvaloniaResource?
The latter
ok so I have the font at
/Assets/ShadowsIntoLight-Regular.ttf
. I right-clicked it and ensured that it was set to AvaloniaResource. I then wen into App.axaml
and did
and my font didn't work.avares://GoogleFonts/Assets/Fonts#Nunito
Nunito being the font name
not the file nameso then I should have
avares://Assets#ShadowsIntoLight-Regular
?Remove
-Regular
That is managed by the font weightok now I've got
and it's still not working. I'm getting some sort of glyphFace error
Could not create glyph Typeface
I'm getting some sort of glyphFace errorAny errors or anything to show?
^
Try to specify the font directly
/Assets/Fonts/YourFont.ttf#
or be more explicit
avares://YourNamespace/Assets/ShadowsIntoLight-Regular.ttf
App.axaml
: https://pastebin.com/i79tny2H
CreateUserView.axaml
: https://pastebin.com/TZYqXeXE
path of image /Assets/ShadowsIntoLight.ttf
I am trying everything I'm finding and what you're suggesting and it's just not working.Your path is incorrect
avares://Assets/ShadowsIntoLight.ttf
you are missing the namespace
before Assets
https://discord.com/channels/143867839282020352/1213995451393777664/1214002290445393920
As written hereBuddy
Try to specify the font directly
/Assets/Fonts/YourFont.ttf#
or be more explicit
avares://YourNamespace/Assets/ShadowsIntoLight-Regular.ttf
Quoted by
<@203166497198047232> from #Font Families Support By Avalonia? (click here)
React with ❌ to remove this embed.
that didn't work either
this didn't work either
Submit an issue then, if you have tried everything and followed docs by the exact
Try also to update your avalonia version
ok ty
avares://TrackItEarnings/Assets/Fonts#Macondo
worked when I downloaded a second font to test. It works just fine so I'm assuming the problem is the font itself.I see.
Hopefully the font download was just corrupted
hopefully. I'll test it later. thank you again for your help
Anytime.
question then. would you happen to know how to set the bottom border color? In css it would be like
I'm wanting to do it on the Label.Title
You can't set the colors individually from what I know of, but you can set the border thickness individually
oh ok. let me give that a shot. thanks
You can write your own control that has the ability to do that
<Setter Property="BorderThickness" Value="0,0,0,2" />
this wound up being what I needed. Thank you!Anytime 🙂