title: Cocoa (OS X) small font - kerning looks awful
body: <p>I have a Cocoa OS X application that creates PDFs for printing. I'm having a problem that when I use small font sizes, the kerning seems all wrong. Here is a screen shot. This is an enlargement from a PDF output by my app, using Helvetica at 6 points.
  <img src="https://i.stack.imgur.com/jaZ3Q.jpg" alt="Horrible Kerning Output"></p>
  
  <p>As you can see, the kerning is horrible, with some characters touching and others too far apart.</p>
  
  <p>The code I am using basically looks like this (this is a simplified example that reproduces the problem for me):</p>
  
  <pre><code>NSString* dateStr = @"Printed 04/03/2012";
  NSFont* detailsFont = [NSFont fontWithName:@"Helvetica" size:6];
  NSMutableAttributedString* printedDate = [[NSMutableAttributedString alloc] initWithString:dateStr];
  [printedDate addAttribute:NSFontAttributeName value:detailsFont range:NSMakeRange(0, [dateStr length])];
  NSRect printedDateRect = NSMakeRect(0, 0, theWidth, 10);
  [printedDate drawInRect:printedDateRect];
  </code></pre>
  
  <p>This isn't unique to Helvetica, it happens in all the fonts I've tried, though it is more pronounced in some than others. If I use a larger size, like 10, it looks fine. 6 point Helvetica from other apps such as Text Edit looks fine. What do I need to do to render 6 point text properly?</p>
  
  <p>Edited to add: I just noticed that this seems much worse with TrueType fonts than with PostScript fonts. Sadly, I don't have PostScript versions of many of the fonts I want to use, so avoiding TrueType isn't really an option.</p>
  
  <p>I'm running OS X 10.7.3 and XCode 4.2.1.</p>