My Mac OS application draws some text using code like this:
void drawString(NSString* stringToDraw)
{
NSFontManager *fontManager = [NSFontManager sharedFontManager];
NSString* fontName = [NSString stringWithCString: "Helvetica" encoding: NSMacOSRomanStringEncoding];
NSFont* font = [fontManager fontWithFamily:fontName traits:0 weight:5 size:9];
NSMutableDictionary *attribs = [[NSMutableDictionary alloc] init];
[attribs setObject:font forKey:NSFontAttributeName];
[stringToDraw drawAtPoint:NSMakePoint (0, 0) withAttributes:attribs];
}
Since text drawing is very small part of the application this simple approach has worked well so far. But now with the new retina display, users complain that the text appears too big compare to the rest of the graphics. It seems that giving an absolute font size (9 in my case) no longer works.
How can I fix this code so that it works well for both retina and non-retina displays?