• 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
Re: lineBreakBeforeIndex Question
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: lineBreakBeforeIndex Question


  • Subject: Re: lineBreakBeforeIndex Question
  • From: Douglas Davidson <email@hidden>
  • Date: Mon, 10 Oct 2005 17:38:08 -0700


On Oct 10, 2005, at 5:19 PM, Kynerd Coleman wrote:

I am trying to detect where within an NSAttributedString a line of
text breaks in an NSRect.


The string drawing methods are conveniences that don't provide answers to detailed questions of this sort. To go further, you would want to create an NSLayoutManager/NSTextContainer/NSTextStorage combination, either by hand or else by just creating an NSTextView and letting it create all the rest. Once this is created and initialized with your text, you can ask the NSLayoutManager any question you like about the layout that results; it will tell you exactly which glyphs end up on which line, where they fall, which characters they represent, and so forth. You can then use the same objects to do your drawing, either via NSTextView APIs (if you have a text view) or via NSLayoutManager APIs. If you are doing these sorts of operations repeatedly, you may wish to reuse these objects rather than recreate them each time.


Douglas Davidson

_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden


References: 
 >lineBreakBeforeIndex Question (From: Kynerd Coleman <email@hidden>)

  • Prev by Date: Agent application's MainMenu.nib?
  • Next by Date: Re: awakeFromNib not called
  • Previous by thread: lineBreakBeforeIndex Question
  • Next by thread: Agent application's MainMenu.nib?
  • Index(es):
    • Date
    • Thread