【问题标题】:Xamarin Forms - UWP FontsXamarin 表单 - UWP 字体
【发布时间】:2017-01-02 12:04:16
【问题描述】:

我今天来这里,就同一个问题又来了一次......我找不到,尽管我能看到的每一个帖子或问题,或者我得到的答案..

如何使用 UWP 使用自定义字体?

我红了教程,老实说,我想我小时候就知道它是***诗!

我尝试了很多,但没有任何效果......

font = "/Assets/Fonts/Roboto-Light.ttf#Roboto Light";
font = @"\Assets\Fonts\Roboto-Light.ttf#Roboto Light";
font = "./Assets/Fonts/Roboto-Light.ttf#Roboto Light";
font = @".\Assets\Fonts\Roboto-Light.ttf#Roboto Light";
font = "/Fonts/Roboto-Light.ttf#Roboto Light";
font = @"\Fonts\Roboto-Light.ttf#Roboto Light";

【问题讨论】:

标签: fonts xamarin.forms uwp


【解决方案1】:

这里有一件重要的事情是,对于some weight of font,例如Light/Bold等,我们不使用#符号后的完整字体名称

例如,如果我们需要将 Roboto Light 设置为 Font,请改用 Roboto

/Assets/Fonts/Roboto-Light.ttf#Roboto

XAML:

<TextBlock FontFamily="/Assets/Fonts/Roboto-Light.ttf#Roboto" Text="This is a test: Roboto Light FontSize: 10" FontSize="10" />

【讨论】:

  • 天哪,完美!它确实有效......为什么 xamarin 不把那个注释放在官方字体教程上?谢谢!
  • 我很高兴最终找到你的答案,我在 stackoverflow 和 xamarin.forums 上提出了大约 4-5 个问题..
猜你喜欢
  • 2017-06-01
  • 2018-03-28
  • 2017-01-15
  • 2019-05-27
  • 1970-01-01
  • 1970-01-01
  • 2018-02-15
  • 2018-03-01
  • 2018-03-25
相关资源
最近更新 更多