title: Why are fonts in java 1.7 different to 1.6?
body: <p>I've been building a development environment in Java (as a small research project). As part of that, I built a custom text component that draws the text itself using Graphics2d like so:</p>
  
  <pre><code>g2.drawString("some text", 100, 100);
  </code></pre>
  
  <p>Everything worked fine developing things in Eclipse using 1.6 (I assume this is provided by Apple), until I packaged everything up and ran in java 1.7 (provided by Oracle). Obviously in development environments fonts are pretty important, so I was displeased to see the results in 1.7. </p>
  
  <p><img src="https://i.stack.imgur.com/fWfaK.jpg" alt="enter image description here"> </p>
  
  <p>I have tried packaging custom fonts, but they all appear grainy and eroded. The comparison above isn't too bad, but some fonts (like Monaco) look terrible. </p>
  
  <p>I'm guessing this is to do with how Apple hooks things into Quartz. But is there any way to improve things so it doesn't look terrible on other systems? Does anyone have a strategy for this? </p>
  
  <p>Update: This is the comparison in Monaco:
  <img src="https://i.stack.imgur.com/R7mbS.png" alt="enter image description here"></p>
  
  <p>and a zoomed comparison of the C (in paintComponent) in Monaco (1.7 on left, 1.6 on right). Note that I am loading the font from a local ttf file using:</p>
  
  <pre><code>GraphicsEnvironment ge = GraphicsEnvironment.getLocalGraphicsEnvironment();
  InputStream is = Thread.currentThread().getContextClassLoader().getResourceAsStream("monaco.ttf");
  Font customFont = null;
  try
  {
  customFont = Font.createFont(Font.TRUETYPE_FONT, is);
  customFont = customFont.deriveFont(16.0f).deriveFont(Font.BOLD);
                      is.close();
                      ge.registerFont(customFont);
                  } catch (FontFormatException e1)
                  {
                      e1.printStackTrace();
                  } catch (IOException e1)
                  {
                      e1.printStackTrace();
                  }
  this.setFont(customFont);
  </code></pre>
  
  <p><img src="https://i.stack.imgur.com/I7pFT.png" alt="enter image description here"></p>
  
  <p>Note also that anti aliasing is turned on using:</p>
  
  <pre><code> g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING, 
                      RenderingHints.VALUE_ANTIALIAS_ON);
  </code></pre>