text drawing question
text drawing question
- Subject: text drawing question
- From: Vinay Prabhu <email@hidden>
- Date: Wed, 25 Apr 2007 13:33:49 +0530
- Importance: Normal
Hi,
Is it possible to flip the NSTextContainer view coordinates?
In my application, I would like to draw the flipped text.
Code,
NSTextStorage* textStorage = [[NSTextStorage alloc]
initWithAttributedString:drawString];
NSLayoutManager* layoutManager = [[NSLayoutManager alloc] init];
NSTextContainer* textContainer = [[NSTextContainer alloc]
initWithContainerSize:rect.size];
[layoutManager addTextContainer:textContainer];
[textStorage addLayoutManager:layoutManager];
NSRange glyphRange = [layoutManager
glyphRangeForTextContainer:textContainer ];
[[NSGraphicsContext currentContext] saveGraphicsState];
NSAffineTransform* affineTransform = [NSAffineTransform transform];
[affineTransform translateXBy:0 yBy:rect.size.height];
[affineTransform scaleXBy:1 yBy:-1];
[affineTransform concat];
[layoutManager drawGlyphsForGlyphRange:glyphRange atPoint:rect.origin];
[[NSGraphicsContext currentContext] restoreGraphicsState];
With the above code, instead of flipping character by character, it flipps
the entire drawing coordinates.
So instead of drawing like,
Line 1
Line 2
Line 3
It draws like,
Line3
Line2
Line1
So how do I flip character by character and draw?
Regards
Vinay
_______________________________________________
Cocoa-dev mailing list (email@hidden)
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