I'm trying to figure out how all these elements in TextKit 2 work together.
NSTextElement- Abstract class and meant to be subclassed. macOS provides a concrete subclass NSTextParagraph.NSTextLayoutManager- Probably not meant to be subclassed. Accepts a delegate that can provide aNSTextLayoutFragmentfor a givenNSTextElement.NSTextContentManager- Abstract class. Interface allows for concrete instances to provide an array ofNSTextElementfor a givenNSTextRange.
I'd like to customize the way text is presented, and am having the devils time doing it :-)
I have subclassed NSTextContentManager and generate NSTextElements (on the paragraph level). If it's an NSTextParagraph, TextKit seems to automagically (?) generate the corresponding NSTextLineFragments when the NSTextLayoutFragment is created.
When the NSTextLayoutFragment is created it's state will be .none (I think). What makes it move between the different states (.none -> .layoutAvailable)? I don't see any customization points for this. When customizing NSTextLayoutFragment, should I just do layout at init (and store it somewhere)? Or is there a better place to do this?
Thanks