开发者

bitmap fonts in cocoa touch

Is it possible to use bitmap fonts in c开发者_开发知识库ocoa touch / quartz 2d? If yes how do I do that?


Look at CGContextSelectFont below:

void MyDrawText (CGContextRef myContext, CGRect contextRect)

{

    float w, h;

    w = contextRect.size.width;

    h = contextRect.size.height;

    CGAffineTransform myTextTransform;

    CGContextSelectFont (myContext, "Helvetica-Bold", h/10, kCGEncodingMacRoman);
    CGContextSetCharacterSpacing (myContext, 10);

    CGContextSetTextDrawingMode (myContext, kCGTextFillStroke);

    CGContextSetRGBFillColor (myContext, 0, 1, 0, .5);

    CGContextSetRGBStrokeColor (myContext, 0, 0, 1, 1);

    myTextTransform =  CGAffineTransformMakeRotation  (MyRadians (45));

    CGContextSetTextMatrix (myContext, myTextTransform);

    CGContextShowTextAtPoint (myContext, 40, 0, "Quartz 2D", 9);

}
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜