Dealing with glyphs that draw outside their NSTextView
Dealing with glyphs that draw outside their NSTextView
- Subject: Dealing with glyphs that draw outside their NSTextView
- From: Ross Carter <email@hidden>
- Date: Thu, 04 Mar 2010 15:53:16 -0500
In a new TextEdit "Wrap to Page" document, change the font to Zapfino and type a lowercase f. The left swash is cut off. I would like to draw the entire glyph, as Pages does (and I am aware that Pages does not use NSTextView).
It's easy enough to draw the entire glyph by sending -lockFocus to the NSTextView's superview before the NSLayoutManager sends drawGlyphsForGlyphRange:atPoint:. The problem is determining what part of the superview needs to be redrawn when the glyph is moved or deleted.
NSLayoutManager boundingRectForGlyphRange:inTextContainer: is supposed to "determine the area that contains all drawing performed for a range of glyphs." However, the rect it returns does not include the complete area drawn by the glyph (the method returns a width of 6.5, while the width of the glyph is 38.87, as determined by NSFont -boundingRectForGlyph:).
Is there a way to determine the rect or rects actually drawn by drawGlyphsForGlyphRange:atPoint:? Or, is there a better approach to insuring that all parts of every glyph are drawn?
-Ross
_______________________________________________
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