将自定义字体添加到Windows Phone 8应用程序 [英] Adding a custom font to a windows phone 8 app

查看:159
本文介绍了将自定义字体添加到Windows Phone 8应用程序的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经阅读过这样的文章 31天的windows phone第24天嵌入字体这个 Windows 8的xaml提示自定义字体,非常清楚,简单地解释如何做到这一点。

但由于某种原因我无法弄清楚,我的自定义字体不显示在我的应用程序,无论是在设计器视图或当我运行它。



为了确保我没有'我没有留下任何一个步骤,我展示了我在这里所做的对于我的问题可能有什么建议:

1。首先,这是我的xaml文本块代码

 < StackPanel Grid.Row =1x:Name =BottomPanelHeight = 120宽度=800方向=水平> 
< StackPanel.Background>
< SolidColorBrush Color ={StaticResource PhoneSemitransparentColor}/>

< / StackPanel>

2.我在我的项目中创建了一个文件夹,叫做Fonts 这就是我复制我的字体文件的地方。



3. 我更改了 Build Action Content 。我首先将 Copy To Output Directory 属性保留为 None ,然后将其更改为 Copy如果较新。没有成功。



我做了什么错误,或者我没有做什么?

解决方案 使用这个

    

如果这不起作用,记住格式是.\FontPath\FontFileName.ttf #FontName


I've read articles such as this 31 days of windows phone day 24 embedding-fonts and this windows 8 xaml tips custom fonts that explain very clearly and simply how to do this.

But for some reason I can't figure out, my custom font doesn't show on my app, whether in the designer view or when I run it.

To be sure I haven't left any step out, I'm showing what I did here for any suggestions on what my issue might be:

1. First, this is my xaml textblock code

<StackPanel Grid.Row="1" x:Name="BottomPanel" Height="120" Width="800" Orientation="Horizontal">
            <StackPanel.Background>
            <SolidColorBrush Color="{StaticResource PhoneSemitransparentColor}"/>
            </StackPanel.Background>
            <TextBlock x:Name="MainTextBlock" FontFamily="/Fonts/KOMIKAX_.ttf" TextWrapping="Wrap" Text="Hello" Width="680" Height="120" Margin="10,0,0,0" FontSize="25" Padding="20,10"/>

</StackPanel>

2. I created a folder in my project, called it "Fonts" and that is where I copied my font file.

3. I changed the Build Action of the font file to Content. I left the Copy To Output Directory property as None at first, then changed it to Copy If Newer. No success.

What have I done wrong or what did I leave out?

解决方案

Try using this

<TextBlock x:Name="MainTextBlock" FontFamily=".\Fonts\KOMIKAX_.ttf#Komika Axis" TextWrapping="Wrap" Text="Hello" Width="680" Height="120" Margin="10,0,0,0" FontSize="25" Padding="20,10"/>

In case this doesn't work, remember the format is .\FontPath\FontFileName.ttf#FontName

这篇关于将自定义字体添加到Windows Phone 8应用程序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆