简体   繁体   English

无法在我的应用程序上使用自定义字体

[英]Can't use custom font on my app

I downloaded a font, and I created a folder Fonts inside the Assest in my project and used the following XAML code to set the font. 我下载了一种字体,并在项目的Assest中创建了一个文件夹Fonts ,并使用以下XAML代码设置了字体。

<TextBlock HorizontalAlignment="Left"
           Height="107"
           Margin="154,75,0,0"
           TextWrapping="Wrap"
           Text="Brain Train"
           VerticalAlignment="Top"
           Width="310"
           FontSize="60"
           FontFamily="./Assets/Fonts/Foxes In Love.ttf#Foxes In Love"
           FontWeight="Thin" 
           Grid.RowSpan="2" />

In the Designer , when I add the Upper XAML Code, the font changes but when I run the app the font is set to default (not the Custom). Designer中 ,当我添加上XAML代码时,字体会更改,但是在运行应用程序时,字体会设置为默认字体(而不是“自定义”)。

Why? 为什么?

MAKE small changes in your path according to this link 根据此链接在路径上进行一些小的更改

click here 点击这里

<TextBlock HorizontalAlignment="Left" Height="107" Margin="154,75,0,0"
 TextWrapping="Wrap" Text="Brain Train" VerticalAlignment="Top"
 Width="310" FontSize="60"
 FontFamily=".\Fonts\Foxes In Love.ttf#Foxes In Love" FontWeight="Thin" Grid.RowSpan="2"/>

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM