Iphone CGContextShowTextAtPoint for Japanese characters

后端 未结 4 2206
花落未央
花落未央 2020-12-06 13:03

I am working on an app where I am using CGContextShowTextAtPoint to display text to the screen. I want to also display Japanese characters, but CGContextS

4条回答
  •  死守一世寂寞
    2020-12-06 13:13

    CoreText can help you:

    1. CTFontGetGlyphsForCharacters (iOS 3.2 onwards) maps Unicode characters to glyphs
    2. CTFontDrawGlyphs (iOS 4.2 onwards) draws the glyphs into a CGContext.

    NB. CGContextShowGlyphs should work, but I never found a way to convert my UniChars to glyphs. More on that here:

    Ancient, pre iOS 3.2 answer

    you need to use UIKit for this.

    Check out [NSString drawAtPoint:...] to get started.

    This SO question is useful, too.

    I don't know what they were thinking with the CoreGraphic text stuff, it's useless.

提交回复
热议问题