Re: NSString width
Re: NSString width
- Subject: Re: NSString width
- From: Jens Alfke <email@hidden>
- Date: Sun, 6 Sep 2009 12:01:46 -0700
On Sep 6, 2009, at 2:03 AM, Dave Keck wrote:
I've noticed this too. If you need the absolute precise pixel-size of
some text, then the only way I know of (that works with all different
styles of text) is manually drawing the text into some temporary
context, and analyzing its pixels.
-[NSString boundingRectWithSize:...] might do this, especially with
the NSStringDrawingUsesDeviceMetrics flag ("Uses image glyph bounds
instead of typographic bounds").
Failing that, you ought to be able to use NSLayoutManager to compute
the bounding box of all the glyphs, but I don't know how.
—Jens
_______________________________________________
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