text orientation/positioning with layout manager
text orientation/positioning with layout manager
- Subject: text orientation/positioning with layout manager
- From: Todd Heberlein <email@hidden>
- Date: Mon, 31 Jan 2011 14:09:58 -0800
I'm doing a simple experiment using NSTextStorage, NSLayoutManager, NSTextContainer to draw some text (I am basing this on the CircleView example because I want some of that orientation power later).
I have found that when rendering the text using drawGlyphsForGlyphRange:atPoint:, I don't get the text where I expected. It is higher than I expect. Furthermore, when I draw a rectangle around the text (or try to) using the rectangle from usedRectForTextContainer:, the text is outside the rectangle (in short, the rectangle is where I expect it to be, but the text glyphs are not).
Is there a secret incantation that I am missing?
Thanks,
Todd
Basic code snippet:
point = NSMakePoint(1.0, 1.0);
glyphRange = [layoutManager glyphRangeForTextContainer:textContainer];
usedRect = [layoutManager usedRectForTextContainer:textContainer];
usedRect.origin = point;
[layoutManager drawGlyphsForGlyphRange:glyphRange atPoint:point];
[[NSBezierPath bezierPathWithRect: rect] stroke];
_______________________________________________
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