• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
CATextLayer metrics
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

CATextLayer metrics


  • Subject: CATextLayer metrics
  • From: Karl Goiser <email@hidden>
  • Date: Fri, 29 Feb 2008 07:25:33 +1100

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

_______________________________________________

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


  • Follow-Ups:
    • Re: CATextLayer metrics
      • From: Scott Anguish <email@hidden>
    • Re: CATextLayer metrics
      • From: Bill Dudney <email@hidden>
  • Prev by Date: Re: Table views with different NSArrayControllers sharing the same data object...
  • Next by Date: Re: removeFrameUsingName: doesn't?
  • Previous by thread: [Moderator] List guidelines and a quick reminder
  • Next by thread: Re: CATextLayer metrics
  • Index(es):
    • Date
    • Thread