在iPhone上绘制Unicode字符 [英] Drawing Unicode characters on iPhone
问题描述
$ b
看起来像 NSLayoutManager
很容易,但是这个API显然在手机上不可用。看来人们这样做的方式是使用一个私有API, CGFontGetGlyphsForUnichars
,它不会让你通过Apple守门人进入App Store。
任何人都可以指向我的文档,说明如何做到这一点?我很快就失去了头发。
Howard
排除> CGFontGetGlyphsForUnichars
是一个疏忽,而不是一个故意的行动,但我不是b $ b b投注农场它。因此,我使用
[NSString drawAtPoint:withFont:];
(在UIStringDrawing.h中)
$ b 和
[NSString sizeWithFont];
这还有一个好处,就是对字体中缺少的字符进行体面的替换,
>
CGContextShowGlyphs
不行。
Why is it so hard to figure out how to draw Unicode characters on the iPhone, deriving simple font metrics along the way, such as how wide each imaged glyph is going to be in the font of choice?
It looks like it'd be easy with NSLayoutManager
, but that API apparently isn't available on the phone. It appears the way people are doing this is to use a private API, CGFontGetGlyphsForUnichars
, which won't get you past the Apple gatekeepers into the App store.
Can anybody point me to documentation that shows how to do this? I'm losing hair rapidly.
Howard
I assumed that the exclusion of CGFontGetGlyphsForUnichars
was an oversight rather than a deliberate move, however I'm not
betting the farm on it. So instead I use
[NSString drawAtPoint:withFont:];
(in UIStringDrawing.h)
and
[NSString sizeWithFont];
This also has the advantage of performing decent substitution
on characters missing from your font, something that
CGContextShowGlyphs
does not do.
这篇关于在iPhone上绘制Unicode字符的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!