title: How do I specify fallback fonts in Java2D/Graphics2D
body: <p>I'm using <code>g.drawString(str, x, y)</code> to draw a String with a <code>Graphics2D</code> object <code>g</code>. The current font of <code>g</code> does not cover all the characters of <code>str</code> (I have e.g. Chinese chars in there). On Mac OS X, a fallback font seems to be automatically used, but not on Windows, where black square outlines appear instead of the wanted characters.</p>
  
  <ul>
  <li>Why is the behavior different depending on the platform?</li>
  <li>How do I specify a fallback font (or several fallback fonts) in case of missing characters?</li>
  </ul>
  
  <p>(For instance, one of the nice fonts <a href="http://www.clearchinese.com/resources/fonts.htm">there</a>.)</p>
  
  <p><strong>Update/More Info</strong></p>
  
  <p>So, the original font that doesn't support all characters is not one of the JVM's <a href="http://java.sun.com/javase/technologies/core/basic/intl/faq.jsp#font-selection">logical fonts</a>, but is a bundled font that comes with my app and was obtained with <code>Font.createFont()</code>. So, adding fonts to the JRE's <code>lib/fonts/fallback</code> folder doesn't work here.</p>