2010-09-12 58 views

回答

0

请看下面CGContextSelectFont:

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

}