A: 
bonaldi
A: 

You might be interested in Jerry Krinock's great NS(Attributed)String+Geometrics category, which is designed to do all sorts of string measurement, including what you're looking for.

Rob Keniger
+1  A: 

-[NSAttributedString boundingRectWithSize:options:].

You can specify NSStringDrawingUsesDeviceMetrics to get union of all glyph bounds

http://lists.apple.com/archives/Cocoa-dev/2006/Feb/msg00564.html

Unlike -[NSAttributedString size] the returned NSRect represents the dimensions of the area that would change if the string is drawn.

Graham Miln