Re: lineBreakBeforeIndex Question
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