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 CGContextShowTextAtPoint takes as its input a C string. So either A) How do I change Japanese characters into a C string? If this is not possible, B) How can I manually print Japanese characters to the screen (within the drawRect method).
Thanks in advance.
CoreText can help you:
CTFontGetGlyphsForCharacters(iOS 3.2 onwards) maps Unicode characters to glyphsCTFontDrawGlyphs(iOS 4.2 onwards) draws the glyphs into a CGContext.NB.
CGContextShowGlyphsshould 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.