title: Getting FontMetrics StackOverflowError
body: <p>Running the following code:</p>
  
  <pre><code>import java.awt.Font;
  import java.awt.FontMetrics;
  
  public class MetricsTest {
  
      public static void main(String[] args) {
                  Font myFontTest=new Font("Arial", Font.PLAIN, 11);
                  FontMetrics metrics  = new FontMetrics(myFontTest) {};
                  int characterWidth=metrics.charWidth('A');
                  System.out.println(characterWidth);
      }
  }
  </code></pre>
  
  <p>produces this error:</p>
  
  <p>Exception in thread "main" java.lang.StackOverflowError</p>
  
  <p>at java.awt.FontMetrics.getWidths(FontMetrics.java:430)</p>
  
  <p>at java.awt.FontMetrics.charWidth(FontMetrics.java:333)</p>
  
  <p>at java.awt.FontMetrics.getWidths(FontMetrics.java:430)</p>
  
  <p>at java.awt.FontMetrics.charWidth(FontMetrics.java:333)</p>
  
  <p>at java.awt.FontMetrics.getWidths(FontMetrics.java:430)</p>
  
  <p>and so on....</p>
  
  <p>Why?</p>