• 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: line spacing differences between NSTextView and NSAttributedString
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: line spacing differences between NSTextView and NSAttributedString


  • Subject: Re: line spacing differences between NSTextView and NSAttributedString
  • From: Douglas Davidson <email@hidden>
  • Date: Tue, 28 Feb 2006 13:13:16 -0800


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


  • Follow-Ups:
    • Re: line spacing differences between NSTextView and NSAttributedString
      • From: Chris Eplett <email@hidden>
References: 
 >line spacing differences between NSTextView and NSAttributedString (From: Chris Eplett <email@hidden>)

  • Prev by Date: line spacing differences between NSTextView and NSAttributedString
  • Next by Date: Re: Trouble with passing variables
  • Previous by thread: line spacing differences between NSTextView and NSAttributedString
  • Next by thread: Re: line spacing differences between NSTextView and NSAttributedString
  • Index(es):
    • Date
    • Thread