Re: CGContextShowTextAtPoint
Re: CGContextShowTextAtPoint
- Subject: Re: CGContextShowTextAtPoint
- From: Graham Cox <email@hidden>
- Date: Wed, 14 Oct 2015 09:56:33 +1100
> On 14 Oct 2015, at 9:02 am, Raglan T. Tiger <email@hidden> wrote:
>
> NSFont *sysFont = [NSFont systemFontOfSize:10];
> NSString *sysFontName = [sysFont fontName];
> CGContextSelectFont(ctx, [sysFontName cStringUsingEncoding:NSASCIIStringEncoding], 90, kCGEncodingMacRoman);
> CGContextSetTextDrawingMode(ctx, kCGTextFill);
> CGContextShowTextAtPoint (ctx, pt.x,pt.y,(const char*)txt, len );
Converting this to use string drawing is easy enough:
NSDictionary* attributes = @{NSFontAttributedName:sysFont};
NSString* myText = [NSString stringWithUTF8String:txt]; // check encoding if not UTF-8
[myText drawAtPoint:pt withAttributes:attributes];
—G.
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden