無為空間
むいむい(´ω`*)
Entries
NSView等、Macの座標系は左下基点。
それに対し、UIView等、iPhoneの座標系は左上基点。
drawAtPoint 等、iPhone用の文字列描画関数はその違いを吸収するが、 CGContextShowGlyphsAtPoint のような素のCore Graphics向け文字列描画関数は、自分でtext matrixを上下逆に設定しなければならない。
const CGGlyph glyphs[] = { 674, 1, 127, 1058, 646, 675 };
CGFontRef font = CGFontCreateWithFontName((CFStringRef)@"HiraKakuProN-W6");
CGContextSetFont(context, font);
CGContextSetFontSize(context, 48);
CGContextSetRGBFillColor(context, 0.0f, 0.0f, 0.0f, 1.0f);
CGContextSetTextMatrix(context, CGAffineTransformIdentity);
CGContextShowGlyphsAtPoint(context, 50, 50, glyphs, sizeof(glyphs) / sizeof(*glyphs));
CGFontRelease(font);
↑のコードでNSViewに描くと

UIViewに描くと

コメント
コメントの投稿
トラックバック
- トラックバック URL
- http://idlysphere.blog66.fc2.com/tb.php/153-1f0e6604
- この記事にトラックバックする(FC2ブログユーザー)