lib/browser/GraphBrowser/AWTFontMetrics.java
author wenzelm
Tue, 01 Apr 2014 22:25:01 +0200
changeset 56355 1a9f569b5b7e
parent 33686 8e33ca8832b1
permissions -rw-r--r--
some rephrasing to ensure that this becomes cheap "foreach" and not expensive "map" (cf. 0fc032898b05);

/***************************************************************************
  Title:      GraphBrowser/AWTFontMetrics.java
  Author:     Gerwin Klein, TU Muenchen

  AbstractFontMetrics from the AWT for graphics mode.
  
***************************************************************************/

package GraphBrowser;

import java.awt.FontMetrics;

public class AWTFontMetrics implements AbstractFontMetrics {
  private FontMetrics fontMetrics;

  public AWTFontMetrics(FontMetrics m) {
    fontMetrics = m;
  }

  public int stringWidth(String str) {
    return fontMetrics.stringWidth(str);
  }

  public int getAscent() {
    return fontMetrics.getAscent();
  }

  public int getDescent() {
    return fontMetrics.getDescent();
  }
}