Re: Displaying an arbitrary unicode character using CGContextShowTextAtPoint or CGContextShowGlyphsAtPoint
Re: Displaying an arbitrary unicode character using CGContextShowTextAtPoint or CGContextShowGlyphsAtPoint
- Subject: Re: Displaying an arbitrary unicode character using CGContextShowTextAtPoint or CGContextShowGlyphsAtPoint
- From: Jeff Schriebman <email@hidden>
- Date: Fri, 30 Mar 2012 17:35:13 -0700
The final code ended up looking like this
NSDictionary* fontAttrs = [NSDictionary dictionaryWithObjectsAndKeys:
[NSColor redColor], NSForegroundColorAttributeName,
[NSFont systemFontOfSize:12], NSFontAttributeName,
nil];
NSString *upArrow = @"\u2B06";
CGContextSaveGState(ctx);
[upArrow drawAtPoint:NSMakePoint(x, y) withAttributes:fontAttrs];
CGContextRestoreGState(ctx);
CGContextSetTextMatrix(ctx, CGAffineTransformIdentity);
I needed to save and restore the graphics state as well as reinitialize the text matrix since the ctx state is apparently changed by drawAtPoint:withAttributes:.
On Mar 30, 2012, at 4:43 PM, Kevin Bracey wrote:
> did i miss something, I thought is - (void)drawAtPoint:(NSPoint)point not NSAttributedString not NSString.
>
> Cheers
> kevin
Regards,
Jeff Schriebman
_______________________________________________
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