On Fri, Sep 21, 2012, at 05:33 PM, Graham Cox wrote: > Another approach is to override > -showCGGlyphs:positions:count:font:matrix:attributes:inContext: which is > the primitive drawing method. All of the positioning and context > flippedness has been handled by this point, so you can usually just go > ahead and draw the characters. Inserting some other glyph at this point > for the tab should be straightforward.
I would imagine it would be much better to modify the glyph stream at one of its defined override points: the glyph generator. Subclass NSGlyphGenerator and override -generateGlyphsForGlyphStorage:desiredNumberOfCharacters:glyphIndex:characterIndex: to call through to the sharedGlyphGenerator's implementation to get the standard glyphs before the first tab character, generate a tab glyph and insert it into the glyph storage, and then call through to the sharedGlyphGenerator to generate the remaining characters (repeat this process for each tab character for which a glyph is requested). Call -setGlyphGenerator: on your layout manager to provide an instance of your glyph generator subclass. Aki Inoue describes this approach in the WWDC 2010 video for Session 114 - Advanced Cocoa Text Tips and Tricks. --Kyle Sluder _______________________________________________ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) 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: https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com