• 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
NSAttributesString -size is often very innaccurate
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

NSAttributesString -size is often very innaccurate


  • Subject: NSAttributesString -size is often very innaccurate
  • From: Graham Cox <email@hidden>
  • Date: Fri, 30 Jan 2009 17:46:29 +1100

The documentation for [NSAttributedString size] states:

"Returns the bounding box of the marks that the receiver draws."

I've found that this isn't the case for all fonts - some fonts draw well outside the box this method suggests. For example, one of the worst is Zapfino, which extends well beyond this bounds. However most fonts exhibit some innaccuracies to greater or lesser extent.

This is a problem because if I mark an area for update based on this bounds, as I frequently do, bits of characters can get left on screen. For example changing a text item's font size from say 24 to 12 with Zapfino, an insufficient area is updated, leaving the edges of the larger font behind. I don't want to update more than I have to so I need a way to figure out the true extent of the drawn marks.

I should mention I'm just drawing isolated attributed strings using - drawAtPoint here, not long runs of laid-out text.

Anyone figured this out?

tia,

Graham






_______________________________________________

Cocoa-dev mailing list (email@hidden)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden


  • Follow-Ups:
    • Re: NSAttributesString -size is often very innaccurate
      • From: Quincey Morris <email@hidden>
    • Re: NSAttributesString -size is often very innaccurate
      • From: Nick Zitzmann <email@hidden>
  • Prev by Date: Newbie question.
  • Next by Date: re: Formatting Core Data Conflict List
  • Previous by thread: Newbie question.
  • Next by thread: Re: NSAttributesString -size is often very innaccurate
  • Index(es):
    • Date
    • Thread