• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Displaying an arbitrary unicode character using CGContextShowTextAtPoint or CGContextShowGlyphsAtPoint
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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

References: 
 >Re: Displaying an arbitrary unicode character using CGContextShowTextAtPoint or CGContextShowGlyphsAtPoint (From: Kevin Bracey <email@hidden>)

  • Prev by Date: Re: Displaying an arbitrary unicode character using CGContextShowTextAtPoint or CGContextShowGlyphsAtPoint
  • Next by Date: drawRect using a Category
  • Previous by thread: Re: Displaying an arbitrary unicode character using CGContextShowTextAtPoint or CGContextShowGlyphsAtPoint
  • Next by thread: NSTextField Selected Text
  • Index(es):
    • Date
    • Thread