Question

Objective-C Answers are fine, I am using MonoTouch for reference.

I am writing text on top of a UIImage. Retina displays the font in a choppy way. Looks pixel doubled, which I guess is what's happening. How can I get a crisp Font written to a UIImage?

 //context is a CGBitmapContext

 context.SetFillColor (color.CGColor);
 context.SelectFont (font.Name, font.PointSize, CGTextEncoding.MacRoman);

 context.SetTextDrawingMode (CGTextDrawingMode.Fill);
 context.ShowTextAtPoint (pt.X, pt.Y, text);

enter image description here

Was it helpful?

Solution

when you create image context, you should call the

UIGraphicsBeginImageContextWithOptions(CGSize size, BOOL opaque, CGFloat scale);

not the regular UIGraphicsBeginImageContext, this will generate a context capable display in Retina display.

OTHER TIPS

Try rounding the coordinates at which you display your text. Also check of the button as a whole is on integer offsets. If you position elements at non-integer offsets, iOS will happily go and interpolate your graphics, rendering things "fuzzy".

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top