将TTF字体添加到PhoneGap应用程序 [英] Adding TTF font to PhoneGap app

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

问题描述

我已遵循这个诀窍:
http://forrst.com/posts/Using_custom_fonts_on_iPad_and_iPhone_with_Phone- u2P



我无法在我的iPhone上显示字体。



我不确定的是什么;是在哪里添加:在你的info.plist中添加一个名为'UIAppFonts'的数组键。在item0中输入包含扩展名的字体名称。我没有info.plist文件只有一个PhoneGap.plist和app_name-Info.plist



我添加了它,但仍然没有。



您在使用的字体有什么规则吗?

解决方案

在Xcode 4.3中选择主项目


  1. 在这里,您应该找到一个应用程序提供的字体键。如果不是,则需要通过控制点击(或右键单击)任何现有键并选择添加行添加。在下拉列表中找到应用程序提供的字体并使用它。默认情况下应该是Array类型,如果没有,请添加它。


  2. 通过单击键左边的箭头展开。


  3. 您应该至少看到一个Item 0键。如果没有值,请双击其值字段并输入您的第一个字体的名称。


  4. 点击任何项目旁边的+按钮(在选择项目时可见)以添加新行。


您还需要确保字体文件位于项目的资源文件夹中。我相信支持限于.otf和.ttf。


I have followed this tut: http://forrst.com/posts/Using_custom_fonts_on_iPad_and_iPhone_with_Phone-u2P

I cant get the font to display on my iPhone.

What Im unsure about is; is where do you add this : "Add an array key to your info.plist called 'UIAppFonts'. In item0 enter the name of the font including the extension." I have no info.plist file only a PhoneGap.plist and app_name-Info.plist

I added it to both but still nothing.

Is there any rules on the font you are using?

解决方案

In Xcode 4.3 select the main project file in the sidebar (at the top, blue icon) and for each item under "TARGETS" go to the "Info" tab.

  1. Under there you should find a "Fonts provided by application" key. If it's not there it needs to be added by control-clicking (or "right-clicking") any of the existing keys and selecting "Add row". In the drop down find "Fonts provided by application" and use that. It should have the "Array" type by default, if it does not, add it.

  2. Expand the key by clicking the arrow to the left of it.

  3. Under you should at least see an "Item 0" key. If it doesn't have a value, double-click its "value" field and enter the name of your first font.

  4. For every additional font you can click the "+" button next to any of the items (visible when the item is selected) to add a new row.

You also need to be sure that the font files are in your project's "Resources" folder. I believe support is limited to .otf and .ttf.

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

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