Re: line spacing differences between NSTextView and NSAttributedString
Re: line spacing differences between NSTextView and NSAttributedString
- Subject: Re: line spacing differences between NSTextView and NSAttributedString
- From: Chris Eplett <email@hidden>
- Date: Tue, 28 Feb 2006 16:33:44 -0500
Douglas,
Thanks for the quick reply. That did the trick. I guess I wasn't
looking for the right stuff in the archives...
Here's the relevant link so future archive searchers have more
keywords to follow:
http://www.cocoabuilder.com/archive/message/cocoa/2006/1/3/153669
Thanks again!
Chris Eplett
On Feb 28, 2006, at 4:13 PM, Douglas Davidson wrote:
On Feb 28, 2006, at 1:06 PM, Chris Eplett wrote:
I've got an NSAttributedString that I'm drawing using the
drawInRect method in my view. Now, the user can edit this string
by double clicking it. When they do so, I stop drawing the text,
then position and show an NSTextView that has been populated with
the NSAttributedString using [[view textStorage]
setAttributedString:str]. When they click elsewhere, the contents
of the NSTextView are transferred back to my NSAttributedString,
and I hide the NSTextView and start drawing the string again.
Functionally, this all works like a charm. There is a problem,
however, in that the line spacing is not the same when the text
view draws it versus when I draw it w/ drawInRect.
The drawInRect method spaces the lines slightly further apart than
NSTextView does, so the user sees an accordion effect as the text
becomes editable.
I've tried explicitly setting the line spacing to 0 using
NSParagraphStyle, to no avail.
Any thoughts on how I can get NSTextView and NSAttributedString's
drawInRect methods to render the text with the same metrics?
Look in the archives for Aki's post on NSTypesetterBehavior.
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