Iphone CGContextShowTextAtPoint用于日文字符 [英] Iphone CGContextShowTextAtPoint for Japanese characters

查看:367
本文介绍了Iphone CGContextShowTextAtPoint用于日文字符的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在开发一个应用,我正在使用 CGContextShowTextAtPoint 来向屏幕显示文字。我还想显示日文字符,但 CGContextShowTextAtPoint 将C字符串作为输入。所以要么A)如何将日文字符更改为C字符串?如果无法做到这一点,B)如何在屏幕上手动打印日文字符(在drawRect方法中)。

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).

提前致谢。

推荐答案

CoreText可以帮助您:

CoreText can help you:


  1. CTFontGetGlyphsForCharacters (iOS 3.2起)将Unicode字符映射到字形

  2. CTFontDrawGlyphs (iOS 4.2起)将字形绘制成CGContext。

  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 应该可以工作,但我从未找到过将我的UniChars转换为字形的方法。有关此处的更多信息:

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

古代,iOS 3.2之前的回答

您需要使用UIKit。

you need to use UIKit for this.

查看 [NSString drawAtPoint:...] 开始使用。

SO问题也很有用。

我不知道他们用CoreGraphic文字的东西在想什么,这没什么用。

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

这篇关于Iphone CGContextShowTextAtPoint用于日文字符的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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