Re: text orientation/positioning with layout manager
site_archiver@lists.apple.com Delivered-To: Cocoa-dev@lists.apple.com With a flipped environment, the CTM presumably describes a coordinate system starting from the top left corner. So, you're right that all graphics operations including the glyph rendering show up side down. What the Text System does is to apply an inverted text matrix to compensate the flipped CTM automatically (inside -[NSFont setInContext:]) so that the text is rendered correctly regardless of the rendering context flippedness. Aki On 2011/01/31, at 18:04, Todd Heberlein wrote:
On Jan 31, 2011, at 3:23 PM, Aki Inoue wrote:
The precise definition of the point specified by the argument is the top left corner of the text container containing the glyph range in the focused view coordinate system.
This flipped view for fonts confuses me a bit because the fonts are oriented correctly. For example, an 'A' appears upright, not upside down. I'm going to have to ponder/research this a little more.
For now, if I want my string drawn on a base line beginning at the point basePoint, I currently define a glyphPoint which subtracts the font's pointSize from the basePoint's Y value. So far it seems to work on a variety of font sizes. Are there any obvious "gotchas" that I am missing with this approach?
Todd
glyphPoint.x = basePoint.x; glyphPoint.y = basePoint.y - [myFont pointSize];
[layoutManager drawGlyphsForGlyphRange:glyphRange atPoint:glyphPoint];
_______________________________________________ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) 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: http://lists.apple.com/mailman/options/cocoa-dev/site_archiver%40lists.apple... This email sent to site_archiver@lists.apple.com
participants (1)
-
Aki Inoue