Re: Figure out the size of an NSAttributedString
Re: Figure out the size of an NSAttributedString
- Subject: Re: Figure out the size of an NSAttributedString
- From: Nick Zitzmann <email@hidden>
- Date: Wed, 26 Nov 2008 16:20:48 -0700
On Nov 26, 2008, at 4:14 PM, Jean-Nicolas Jolivet wrote:
I know this might seem like a weird idea, but I need to figure out
the size (width and height) of an NSAttributedString that I am
drawing... basically I need to know it because I am drawing it
inside a larger image and I need to position it... however the
string can be of any font/size/length... is there a way to do this??
Yes: <http://developer.apple.com/documentation/Cocoa/Conceptual/TextLayout/Tasks/StringHeight.html#//apple_ref/doc/uid/20001809
>
In addition to what it says in the guide, you also need to set the
typesetter behavior to NSTypesetterBehavior_10_2_WithCompatibility or
you will get inaccurate results if this is a string that is drawn
using one of the built-in methods for drawing.
Nick Zitzmann
<http://www.chronosnet.com/>
_______________________________________________
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