据此帖子:https://devblogs.microsoft.com/xamarin/embedded-fonts-xamarin-forms/
添加自定义字体的新方法是将字体添加为EmbeddedResource,然后在App.xaml.ca中添加此行:
[assembly: ExportFont("DSEG7ModernRegular.ttf")]
但我收到此错误:
Error CS0246 The type or namespace name 'ExportFontAttribute' could not be found (are you missing a using directive or an assembly reference?)
我的项目参考:
[ExportFontAttribute
位于Xamarin.Forms
命名空间中,因此请确保您具有
using Xamarin.Forms;