Skip navigation.
 
mlCATextLayer metrics
FROM : Karl Goiser
DATE : Thu Feb 28 21:25:33 2008

Hello Cocoa people,

With traditional Cocoa text drawing, it is possible to determine the 
size of a piece of text ahead of time with methods like NSString's 
sizeWithAttributes: or with NSCell's cellSizeForBounds:.  These 
methods allow the determination of the width of some text, or the 
number of lines the text would require given a particular width.

But how is it possible to determine these things for a CATextLayer? 
That is, and as a specific question: given a CATextLayer with some 
text and font specifications, and a fixed width, how can I determine 
the number of lines it would require?

Is part of the answer the CATextLayer's bounds, and is this set up 
correctly before calling its preferredFrameSize method?  However, this 
doesn't provide the actual number of lines the text would take.

Do you know how to determine the number of lines in a CATextLayer?


Thank you in advance!

Karl

Related mailsAuthorDate
mlCATextLayer metrics Karl Goiser Feb 28, 21:25
mlRe: CATextLayer metrics Bill Dudney Feb 29, 04:47
mlRe: CATextLayer metrics Scott Anguish Feb 29, 17:42
mlRe: CATextLayer metrics Karl Goiser Feb 29, 23:00
mlRe: CATextLayer metrics Scott Anguish Feb 29, 23:30