问题描述
当我必须包含多个相同字体系列的字体时,我在 iPad 应用程序中使用自定义字体时遇到问题.
I have a problem using custom fonts inside my iPad application when I have to include more than one font of the same font family.
基本上,有些字体会像其他字体一样呈现,尤其是粗体字体.就我而言,我有以下四种字体:
Basically some fonts get rendered like others, especially the bold ones. In my case I have these fours fonts:
钨合金 (好的)
钨黑色 (好的)
钨粗体
钨-半粗体
系统发现所有这些其实我对medium或black没有问题,但是当我选择bold或时semibold 结果是 黑色 字体!
the system found all these in fact I have no problem with medium or black but when I choose the bold or the semibold the result is the black font!
此问题会影响 UILabel 和 UITextField 等原生组件,但也会影响我在应用程序中使用的具有自定义 css 的 html 文档.
this issue affects the native components like UILabel and UITextField but also an html documents with custom css that I'm using inside my application.
我在项目资源和Info.plist文件中正确设置了所有内容,我什至尝试将字体转换为ttf格式但结果没有改变.
I set-up everything correctly in the in the project resources and in the Info.plist file, I even tried to convert the fonts in the ttf format but the result does not change.
我正在使用 iOS sdk 4.2 for 和 iPad 应用程序,重要的是要知道在此操作系统之前(在 3.2 中)我的字体已正确呈现!
I'm using the iOS sdk 4.2 for and iPad application, it's important to know that prior to this os (in 3.2) my fonts were rendered correctly!
到目前为止,我发现的唯一可行的解决方案是编辑字体并为每个字体设置不同的字体系列,但这意味着在代码和 html 中需要做很多工作,所以我会避免这种情况.
The only working solution I found until now is to edit the fonts and set a different font family for each one but this implies a lot of work inside the code and the html so I would avoid this.
我应该尝试什么?
推荐答案
我在其他论坛上找到了解决方案.老实说,我认为这与其说是真正的解决方案,不如说是一种解决方法.
I found a solution reading other forums. Honestly, I think it's more a workaround than a real solution.
我使用字体管理器工具 (Transtype pro) 来编辑字体元数据.我为每种字体设置了一个特定的OT 字体系列",并且PS 字体名称"字段的值相同.这样可以避免框架在不接触代码的情况下混淆同族字体.
I used a font manager tool (Transtype pro) to edit the fonts metadata. I set a specific "OT Font family" for each font with the same value of the field "PS font name". This avoid the framework to confuse fonts of the same family without touching the code.
丑陋,但它有效.
这篇关于在 iPad 应用程序中包含同一系列的多种字体的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!