> On Sun, Dec 23, 2012, at 09:32 PM, Graham Cox wrote: >> I need to use Quartz to draw a single character - a check mark - in a >> graphics context. I don't need anything elaborate, no typesetting etc, I >> just want to draw a single checkmark.
I use the following code to put an arbitrary unicode string into a CGContextRef. It might be useful in your situation. NSString *downArrow = @"\u2B07"; [self showUnicodeString:ctx xPosition:x yPosition:y usingString:downArrow usingColor:[NSColor redColor]]; - (void)showUnicodeString:(CGContextRef)ctx xPosition:(CGFloat)x yPosition:(CGFloat)y usingString:(NSString *)theString usingColor:(NSColor *)theColor { NSDictionary* fontAttrs = [NSDictionary dictionaryWithObjectsAndKeys: theColor, NSForegroundColorAttributeName, [NSFont systemFontOfSize:12], NSFontAttributeName, nil]; CGContextSaveGState(ctx); [theString drawAtPoint:NSMakePoint(x, y) withAttributes:fontAttrs]; CGContextRestoreGState(ctx); CGContextSetTextMatrix(ctx, CGAffineTransformIdentity); } Jeff Schriebman An educated mind can entertain a thought without accepting it - Aristotle _______________________________________________ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) 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: https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com