title: CGContext and retina display
body: <p>guys,
  this is my code:</p>
  
  <pre><code>- (void) renderPageAtIndex:(NSUInteger)index inContext:(CGContextRef)ctx {
      //background
      CGContextSetFillColorWithColor(ctx, [[UIColor colorWithRed:((float)238 / 255.0f) green:((float)233 / 255.0f) blue:((float)215 / 255.0f) alpha:1] CGColor]);
      CGContextFillRect(ctx, CGRectInset(leavesView.bounds, 0, 0));
      //text
      CGContextSetTextDrawingMode(ctx, kCGTextFill);
      CGContextSetTextMatrix(ctx, CGAffineTransformMake(1.0, 0.0, 0.0, 1.0, 0.0, 0.0));
      CGContextSetFillColorWithColor(ctx, [[UIColor blackColor] CGColor]);
      UIGraphicsPushContext(ctx);
  
      CGContextSaveGState(ctx);
      CGContextTranslateCTM(ctx, 0.1f, leavesView.bounds.size.height);
      CGContextScaleCTM(ctx, 1.0f, -1.0f);
  
      CGRect textRect = CGRectMake(5, 5, leavesView.bounds.size.width-10, leavesView.bounds.size.height-10);
      if (pages.count &gt; 0 &amp;&amp; pages.count-1 &gt;= index) {
          [[pages objectAtIndex:index] drawInRect:textRect withFont:font lineBreakMode:UILineBreakModeWordWrap alignment:UITextAlignmentLeft];
      }
  
      CGContextRestoreGState(ctx);
  
      UIGraphicsPopContext();
  }
  </code></pre>
  
  <p>It works perfect on iPhone 2G, 3G, 3GS, but on new models I have problems.</p>
  
  <p>On the retina  text is drawn not to double the resolution, as in the standard.</p>
  
  <p>Have you any ideas?</p>