I have an app with a lot of text rendering going on. Sometimes I need to render about 10 Pages of text in CoreText before being able to display the corresponding view, which does take a considerable amount of time.
To build the pages, I use CTFramesetterCreateFrame
to render a CTFrame to a view. Then I use CTFrameGetVisibleStringRange
to determine which range was rendered, so I know the offset for the next Frame or Page.
Basically my question is, if I have an NSAttributedString
and a CGPath
, both of which I use to draw the text with CoreText, is there any way I can get the visible string range without having to render the complete CTFrame beforehand? I would need this function to be able to find out how many pages a text will have before I actually render it.
Have you tried CTFramesetterSuggestFrameSizeWithConstraints? (https://developer.apple.com/library/mac/#documentation/Carbon/Reference/CTFramesetterRef/Reference/reference.html)