How to include external font in Avalonia application without installing it

I try to use a kind of Chinese fonts HGDH_CNKI.TTF. I put it into sbid/Assets/Fonts/ (my project name is sbid).

And then I try it like this, I use:

<Button Command="{Binding AddProtocol}" FontFamily="/Assets/Fonts/HGDH_CNKI.TTF#HGDH_CNKI">新协议</Button> 

or

<Button Command="{Binding AddProtocol}" FontFamily="avares://sbid/Assets/Fonts/HGDH_CNKI.TTF#HGDH_CNKI">新协议</Button> 

It still doesn’t work. Is there any other steps I need to do?

Add Comment
1 Answer(s)

I found that Avalonia do no support Chinese font family. I change the font family of the .ttf file to English by using FontCreator. Everything is ok.

Answered on July 16, 2020.
Add Comment

Your Answer

By posting your answer, you agree to the privacy policy and terms of service.