How do I change the layout process of NS(ATS)Typesetter?

I am trying to subclass NSATSTypesetter to alter the layout process. Specifically, I want to change the layout of glyphs in the line fragment rectangles. To do this, I need to override layoutParagraph(at:). Unfortunately, there is very little documentation on how the type setting process proceeds.

The most concrete I could find is WWDC 2010, Session 114 "Advanced Cocoa Tips and Tricks". It gives an overview over the general setup and explain glyph generation, but it doesn't go into the layout of glyphs into line fragments.

Does anybody have any more information on what I need to do inside layoutParagraph(at:). In particular, what do I do with the results from getLineFragmentRect(_:usedRect:remaining:forStartingGlyphAt:proposedRect:lineSpacing:paragraphSpacingBefore:paragraphSpacingAfter:) and how do I tell the caller how far the layout proceeded. Just returning the next glyph index doesn't seem to do the job.

Any help would be appreciated!
How do I change the layout process of NS(ATS)Typesetter?
 
 
Q