字体不在iOS中 [英] Font not kerning in iOS

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

问题描述

我使用FontForge创建了一个自定义字体,用于我的iOS应用程序。当我在我的应用程序中使用字体时,字距不被应用。有一个已知的错误,字距不适用于UITextView。我在UILabel和UITextField中使用这个,所以这不是问题。我的目标是iOS 5.0。

我可以在Font Book和Pages中查看字体,看看字距是否正在工作。但是,字距不适用于Mac。我已经在Word中启用了字距,但是在这里不起作用。我不太关心Word。我主要希望在iOS中工作。



我已经创建了字体作为.otf和.ttf字体,用于生成字体的各种FontForge选项组。
我玩过的选项是Apple,OpenType和OT / Old Style和OT / DSIG。页面将适当地应用字距生成选项的所有组合,除非刚刚选中OpenType。当苹果被检查时,字体书将只显示核心,没有别的。
我已经阅读了其他论坛上关于让字体与Word一起工作的一些意见,但没有关于字距调整和iOS的任何具体内容。



任何人都有任何经验:

1)在OS X上使用FontForge在iOS应用程序中成功创建字母字体

)使用在Word中工作的FontForge,在OS X上成功创建字母字体 >这可能会让我更接近,即使你没有在iOS上的字体的经验。



我有一个我玩过的字形的试用版本,但我不想移动到另一个字体程序来完成这项工作。



任何帮助将不胜感激。

UILabel , UITextView UITextField 在底层使用WebKit来呈现它们的内容。 WebKit不尊重字体的内置字距。 iOS 6引入了对所有UIKit控件的归属文本支持。如果设置 UILabel 属性文字属性而不是常规文本属性,然后CoreText渲染将踢,你会得到适当的kerning。但是,在iOS 6中,有一个 UITextField 的错误,即使设置了 attributedText ,字体字距依然是错误的。 p>

如果你确实需要在iOS 5中使用适当的标签,那么有很多很好的替代品。我使用 TTTAttributedLabel ,但 UITextField 你可能要使用Omni的 OUIEditableFrame 。不足之处在于,融入项目是一件痛苦的事情。我最近经历了学习过程,写了一篇漫长的教程如果你有兴趣的话。

I've created a custom font using FontForge for use in my iOS app. When I use the font in my app, kerning is not being applied. There is a known bug that kerning is not being applied for UITextView. I'm using this in a UILabel and UITextField, so that's not the issue. I'm targeting iOS 5.0.

I'm able to view the font in Font Book and Pages and see that kerning is working. However, kerning doesn't work in Word for Mac. I have enabled kerning in Word, but it does not work there. I'm not concerned so much about Word. I primarily want this to work in iOS.

I've created the font as both .otf and .ttf fonts, with a variety of the FontForge options for generating the font set. Options I've played with are Apple, OpenType and OT/Old Style and OT/DSIG. Pages will properly apply kerning for all combinations of the font generation options, except when just OpenType is checked. Font Book will only show kerning when Apple is checked and nothing else. I've read some comments on other forums about getting fonts to work with Word, but not anything specific about kerning and iOS.

Anyone have any experience:

1) successfully creating a kerned font on OS X using FontForge for an iOS app?

OR

2) successfully creating a kerned font on OS X using FontForge that works in Word? This might get me closer, even if you've not had experience with fonts on iOS.

I have a trial version of Glyphs that I've played with, but I don't want to have to move to another font program to get this done.

Any help would be appreciated.

解决方案

In iOS 6 (and below) UIKit controls like UILabel, UITextView and UITextField use WebKit under the hood to render their contents. WebKit doesn't honor a font's built-in kerning. iOS 6 introduced attributed text support for all UIKit controls. If you set the attributedText property of a UILabel instead of the regular text property then CoreText rendering will kick in and you'll get proper kerning. However, in iOS 6 there's a bug with UITextField where font kerning will still be wrong even if setting attributedText.

If you really need proper kerning for labels in iOS 5 there's a lot of great drop-in replacements. I use TTTAttributedLabel but OHAttributedLabel is also great.

If you really need proper kerning for a UITextField you're probably going to want to use Omni's OUIEditableFrame. The downside is that's a pain to integrate into a project. I recently went through the learning process a wrote a lengthy tutorial if you're interested.

这篇关于字体不在iOS中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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