On 01/02/2011, at 1:04 PM, Todd Heberlein wrote:

> 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?


Well, the font height is not the same as the xHeight, which is the distance 
between the top of the character and the baseline. If you use the font's 
xHeight value you'll be a lot closer.

But NSLayoutManager will give you the layout bounding rectangles which are 
correct for the range of text you ask it to lay out - if you draw the glyphs 
into those rects they are definitely correct. For doing fancy text layouts like 
curves, you can still use the layout manager and then transform the resulting 
glyph positions as you want. That's what I do for the text-on-path stuff in 
DrawKit.

--Graham

_______________________________________________

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/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to