Setting the origin of a GC and Text
Setting the origin of a GC and Text
- Subject: Setting the origin of a GC and Text
- From: Jim Crafton <email@hidden>
- Date: Sun, 6 Jul 2003 23:25:27 -0400
I am a bit stumped at the moment:
If I draw text (using the advice of the Apple docs which say that using
NSLayoutManager and friends is ultimately the most efficient way to do
it), and reduce the bounding box of the NSTextContainer it wraps the
text from bottom to top, i.,e. each line is progressively *higher* than
the next due to the bottom left default origin (which really strikes me
as being rather dumb, but whatever).
So I need to know how to deal with this - any advice would be greatly
appreciated. I tried the following (in my experiment NSView subclass's
drawRect())
NSAffineTransform* topLeftXFrm = [NSAffineTransform transform];
[topLeftXFrm scaleXBy:1.0 yBy:-1.0];
[topLeftXFrm translateXBy:0.0 yBy: -bds.size.height];
[topLeftXFrm concat];
//then do text set up
//then draw it
NSRange glyphRange = [layoutManager
glyphRangeForTextContainer:textContainer];
[layoutManager drawGlyphsForGlyphRange: glyphRange atPoint:
NSMakePoint(30,100)];
What I get is text that is laid out top to bottom, as you'd expect but
the glyphs are all backwards, like looking in a mirror! Obviously I
have done something rather stupid to say the least!
Cheers
Jim
_______________________________________________
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.