How to use a custom font with Windows Universal app?

前端 未结 2 1239
攒了一身酷
攒了一身酷 2020-12-16 17:00

Like for my other windows phone 8 projects I wanted to use a custom font. But with the new Universal app architecture I struggle to put that in place.

I have created

相关标签:
2条回答
  • 2020-12-16 17:15

    Use this code in ur xaml

    <TextBlock x:Name="txtblk" HorizontalAlignment="Left" TextWrapping="Wrap" FontFamily="Assets/filename.ttf#Font Name"/>
    
    0 讨论(0)
  • 2020-12-16 17:23

    You're doing it all right, except for the font name (part after the '#'). It seems to be Rex, not Rex Bold.

    <FontFamily x:Key="RexBoldFontFamily">/Fonts/Rex Bold.otf#Rex</FontFamily>
    
    0 讨论(0)
提交回复
热议问题