Xamarin Forms - UWP Fonts

爷,独闯天下 提交于 2019-12-07 13:33:55

问题


I come here today, one more time about the same question... I can't find, in spit of every either post or question I could see, or answer I got about it..

How does work custom fonts with UWP?

I red the tutorial and honestly, I think I know it as a child who knows is *** poem !

I tried so much but nothing work...

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";

回答1:


One important thing here is, for some weight of font, e.g. Light/Bold etc, we don't use the full font name followed # symbol

For example, if we need to set Roboto Light as Font, use Roboto instead.

/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" />


来源:https://stackoverflow.com/questions/39155735/xamarin-forms-uwp-fonts

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!