title: Alternative for sizeWithFont: method
body: <p>I have a class which work is to parse a text into several pages.
  I use sizeWithFont: method to identify when one page ends and another starts.
  But unfortunately since the amount of text which needs to be parsed is pretty big, whole operation needs to be performed on a background thread (takes several second to complete). And therefore sometimes I get visual artifacts on my interface (UIKit is not thread safe but I call it from several threads simultaneously), which I would love to get rid of.</p>
  
  <p>I need to get rid of using sizeWithFont: on background thread. But there just doesn't seem to be an alternative for this method. The only way to find out the width of the text with Core Graphics is to use method stated in apple's documentation:</p>
  
  <blockquote>
    <ol>
    <li>Call the function CGContextGetTextPosition to obtain the current text position.</li>
    <li>Set the text drawing mode to kCGTextInvisible using the function CGContextSetTextDrawingMode.</li>
    <li>Draw the text by calling the function CGContextShowText to draw the text at the current text position.</li>
    <li>Determine the final text position by calling the function CGContextGetTextPosition.</li>
    <li>Subtract the starting position from the ending position to determine the width of the text.</li>
    </ol>
  </blockquote>
  
  <p>But I'm really concerned that this will lead to a huge performance loss.</p>
  
  <p>Anyone knows another way to find out text width?</p>