Windows Phone 8 中的自定义字体使用 [英] Custom font usage in Windows Phone 8

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

问题描述

我在使用 Windows Phone 8 模拟器时遇到了一个奇怪的问题!我有一个小型测试应用程序,我可以在其中更改主页上的页面名称"文本框,以便使用自定义字体显示.现在在 Visual Studio 设计器中,我看到了该字体,并且在运行应用程序时,我也在模拟器中看到了它,所以一切都很好...

I have a weird problem with the Windows Phone 8 emulator! I have a small test app where I change the 'page name' textbox on the mainpage so that it shows using a custom font. Now in the visual studio designer I see that font and when running the app I also see it in the emulator, so all is well...

但是当我将主页移动到名为 View 的文件夹并更改 WMAppManifest.xml 以反映此移动时 > 导航页面现在设置为 View/MainPage.xaml.我仍然在我的设计器中看到这种自定义字体,但在模拟器中不再看到了!!

But when I move the main page into a folder called View and change the WMAppManifest.xml to reflect this move > Navigation page is now set to View/MainPage.xaml. I'm still seeing this custom font in my designer, but not anymore in the emulator!!

我还没有 wp8 设备...所以任何人都可以为我验证这一点,如果在您尝试将失败的项目部署到手机时这个问题是相同的吗?

I don't own a wp8 device yet... so can anyone verify this for me, if this problem is the same when you try to deploy the failure project to the phone?

有人知道为什么会这样吗?非常烦人,无法在模拟器中看到正确的设计.

And does anybody have any clue why this is happening? Very annoying not able to see the correct design in the emulator.

工作和失败的项目

推荐答案

好的,我自己找到了解决方案...这是因为在styles.xaml 中引用了字体.

Ok found the solution myself... it's because of the reference to the font inside the styles.xaml.

应该是完整路径!所以而不是设置:

It should be a full path! So instead of setting:

<Setter Property="FontFamily" Value="Fonts/ClementePDae-Light.ttf#ClementePDae" />

设置:

<Setter Property="FontFamily" Value="/PhoneApp1;component/Fonts/ClementePDae-Light.ttf#ClementePDae" />

一切正常!

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

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