如何在Avalonia应用程序中包括外部字体而不安装它 [英] How to include external font in Avalonia application without installing it

查看:683
本文介绍了如何在Avalonia应用程序中包括外部字体而不安装它的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我尝试使用一种中文字体HGDH_CNKI.TTF.我将其放入sbid/Assets/Fonts/(我的项目名称为sbid).

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>

<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?

推荐答案

我发现 Avalonia不支持中文字体家族. 我通过使用FontCreator将.ttf文件的字体系列更改为英语. 一切都很好.

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.

这篇关于如何在Avalonia应用程序中包括外部字体而不安装它的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆