NSAttributesString -size is often very innaccurate
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