NSAttributedString in NSAffineTransform
NSAttributedString in NSAffineTransform
- Subject: NSAttributedString in NSAffineTransform
- From: Joseph Ayers <email@hidden>
- Date: Sun, 09 Nov 2008 09:01:41 -0500
I am having a tremendous problem getting the vertical text in the y
Axis of a graph. If i try to rotate text specified as
NSAttributedString it appears to get translated in nonlinear ways: I
would assume that in the below, the text would
rotate around NSMinX(rect) and NSMinY(rect) but it doesn't.
Consider:
- (void)drawYLabel:(NSRect)rect
{
NSPoint labelHere;
int xOffSet;
if(drawYLabelFlag == YES)
{
NSAffineTransform *transform = [NSAffineTransform transform];
NSGraphicsContext *context = [NSGraphicsContext currentContext];
// [transform translateXBy:NSMinY(gRect) yBy:0.0];
[transform rotateByDegrees:90.0];
[context saveGraphicsState];
[transform concat];
xOffSet =NSMinY(rect) + ((gHeight/2.0) - [ylabel size].width/2.0);
labelHere = NSMakePoint( xOffSet, NSMinY(rect) +[ylabel
size].height) ;
[ylabel drawAtPoint:labelHere];
[context restoreGraphicsState];
}
}
yLabel is a NSAttributed String
gHeight is the height of rect.
rect is a bounding rect for the graph that is smaller than the frame
of the NSView.
yLabel doesn't appear in the NSView
What am I doing wrong here
I remain,
Joseph Ayers, Professor
Department of Biology and
Marine Science Center
Northeastern University
East Point, Nahant, MA 01908
Phone (781) 581-7370 x309(office), x335(lab)
Boston: 444 Richards Hall (617) 373-4044
Cellular (617) 755-7523, FAX: (781) 581-6076
eMail: email@hidden
http://www.neurotechnology.neu.edu/
_______________________________________________
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