I'm drawing an attributed string with drawInRect which is documented to clip to the rect you pass in. The line break mode of the paragraph style is NSLineBreakByClipping. If the string's text is too wide for the rect (even by a lot), it draws outside of the rect. I've noticed that this only happens if the string will not vertically clip the text with the given rectangle. In other words, if there's enough vertical room for the text but not enough horizontal room, it will not clip the text. If there's not enough vertical room and not enough horizontal room, both axis are properly clipped to the rect.

I've also noticed that if I use NSLineBreakByTruncatingTail, it works fine all the time.


Screenshot: http://www.sethwillits.com/temp/StringClippingBug.png
Code: http://www.pasteit4me.com/32015



Is this a bug?

--
Seth Willits



_______________________________________________

Cocoa-dev mailing list ([email protected])

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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to [email protected]

Reply via email to