• 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: NSAttributedString size method returning bogus data after adding NSParagraphStyle attribute
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: NSAttributedString size method returning bogus data after adding NSParagraphStyle attribute


  • Subject: Re: NSAttributedString size method returning bogus data after adding NSParagraphStyle attribute
  • From: Douglas Davidson <email@hidden>
  • Date: Fri, 13 Feb 2004 13:50:08 -0800

On Feb 13, 2004, at 11:42 AM, Sailor Quasar wrote:

Debugging very quickly revealed that the [attributedString size] call was returning a ridiculous NSSize value. The height is exactly correct, but the width is gigantic (4 million, 500 thousand, 100 pixels?). It seems that having different NSParagraphStyles in the attributed string is wrecking the text layout calculations, but I can't figure out why or any way around it without rewriting an entire set of otherwise working code to use a more complicated text layout method that I really shouldn't need. Am I doing something wrong, or have I actually found a bug in NSAttributedString?

There was a bug along these lines, but I thought it had been fixed. The problem had to do with the fact that [attributedString size] actually lays out the string in a large, effectively infinite-width container, so that centered and right-aligned text ends up being moved far to the right. Mixing left-aligned text with centered or right-aligned text in the same string would still end up causing problems. The general workaround would be to size the text before applying the alignment.

Douglas Davidson
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.

References: 
 >NSAttributedString size method returning bogus data after adding NSParagraphStyle attribute (From: Sailor Quasar <email@hidden>)

  • Prev by Date: Re: static objects "autoreleased with no pool in place - just leaking"
  • Next by Date: Re: NSURL - download files
  • Previous by thread: NSAttributedString size method returning bogus data after adding NSParagraphStyle attribute
  • Next by thread: NSTextView insertion point doesn't reflect paragraphSpacingBefore
  • Index(es):
    • Date
    • Thread