Re: Outputing rotated text
Re: Outputing rotated text
- Subject: Re: Outputing rotated text
- From: Scott Thompson <email@hidden>
- Date: Mon, 5 Apr 2004 21:18:41 -0500
On Apr 5, 2004, at 7:32 AM, Mark Woollard wrote:
What is the correct way to output rotated text? I've been doing this
in my app by setting the bounds to the text location, setting the
bounds rotation as required for the text, outputting the text and then
restoring the bound and rotation to the original state. This works
fine for screen output but does not work for printed output. I can't
figure out another way of outputting the text at an angle but I assume
there must be one as my current technique doesn't work for printed
output.
Any ideas:-)
Instead of rotating the view, try rotating the drawing context. Look
at NSAffineTransform and NSGraphicsContext.
You want something like:
[NSGraphicsContext saveGraphicsState];
NSAffineTransform *affineTransform = [NSAffineTransform transform];
[affineTransform translateXBy: 100 yBy: 100];
[affineTransform rotateByDegrees: 35];
/* Draw Text */
[NSGraphicsContext restoreGraphicsState];
Scott
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.