title: Messed up BufferedImage fonts on OS X
body: <p>For some reason, a string drawn to a <code>BufferedImage</code> appears differently to one drawn straight to a <code>JComponent</code>. </p>
  
  <p>Here's an example. The top string is drawn directly, while the bottom is drawn using a buffer. </p>
  
  <p><img src="https://i.stack.imgur.com/qG4e6.png" alt="Huh?"></p>
  
  <p>What is going on here?</p>
  
  <pre><code>import javax.swing.*;
  import java.awt.*;
  import java.awt.image.BufferedImage;
  import java.util.Map;
  
  public class Main {
  
      static class Canvas extends JComponent
      {
          @Override
          public void paintComponent(Graphics g)
          {
  
              g.setColor(Color.WHITE);
              g.fillRect(0, 0, this.getWidth(), this.getHeight());
              g.setColor(Color.BLACK);
              g.drawString("OMFG look at this 'S'", 10, 20);
  
              BufferedImage bi = new BufferedImage(150,50,BufferedImage.TYPE_INT_RGB);
              Graphics2D imageG =  bi.createGraphics();
              imageG.setColor(Color.WHITE);
              imageG.fillRect(0, 0, 150, 50);
              imageG.setColor(Color.BLACK);
              imageG.setFont(g.getFont());
              imageG.drawString("OMFG look at this 'S'", 10, 10);
  
              g.drawImage(bi, 0, 30, this);
  
          }
      }
      public static void main(String[] args) {
          JFrame jf = new JFrame();
          jf.setMinimumSize(new Dimension(150, 80));
          jf.add(new Canvas());
          jf.setVisible(true);
  
      }
  }
  </code></pre>