lib/browser/GraphBrowser/AWTFontMetrics.java
author wenzelm
Thu, 04 Mar 2021 15:59:28 +0100
changeset 73362 dde25151c3c1
parent 33686 8e33ca8832b1
permissions -rw-r--r--
tuned --- fewer warnings;
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
13970
4aef7117817b cleanup, comments
kleing
parents: 13968
diff changeset
     1
/***************************************************************************
4aef7117817b cleanup, comments
kleing
parents: 13968
diff changeset
     2
  Title:      GraphBrowser/AWTFontMetrics.java
4aef7117817b cleanup, comments
kleing
parents: 13968
diff changeset
     3
  Author:     Gerwin Klein, TU Muenchen
4aef7117817b cleanup, comments
kleing
parents: 13968
diff changeset
     4
4aef7117817b cleanup, comments
kleing
parents: 13968
diff changeset
     5
  AbstractFontMetrics from the AWT for graphics mode.
4aef7117817b cleanup, comments
kleing
parents: 13968
diff changeset
     6
  
4aef7117817b cleanup, comments
kleing
parents: 13968
diff changeset
     7
***************************************************************************/
4aef7117817b cleanup, comments
kleing
parents: 13968
diff changeset
     8
13968
689868b99bde eliminated dependencies on AWT for batch mode
kleing
parents:
diff changeset
     9
package GraphBrowser;
689868b99bde eliminated dependencies on AWT for batch mode
kleing
parents:
diff changeset
    10
689868b99bde eliminated dependencies on AWT for batch mode
kleing
parents:
diff changeset
    11
import java.awt.FontMetrics;
689868b99bde eliminated dependencies on AWT for batch mode
kleing
parents:
diff changeset
    12
689868b99bde eliminated dependencies on AWT for batch mode
kleing
parents:
diff changeset
    13
public class AWTFontMetrics implements AbstractFontMetrics {
689868b99bde eliminated dependencies on AWT for batch mode
kleing
parents:
diff changeset
    14
  private FontMetrics fontMetrics;
689868b99bde eliminated dependencies on AWT for batch mode
kleing
parents:
diff changeset
    15
689868b99bde eliminated dependencies on AWT for batch mode
kleing
parents:
diff changeset
    16
  public AWTFontMetrics(FontMetrics m) {
689868b99bde eliminated dependencies on AWT for batch mode
kleing
parents:
diff changeset
    17
    fontMetrics = m;
689868b99bde eliminated dependencies on AWT for batch mode
kleing
parents:
diff changeset
    18
  }
689868b99bde eliminated dependencies on AWT for batch mode
kleing
parents:
diff changeset
    19
689868b99bde eliminated dependencies on AWT for batch mode
kleing
parents:
diff changeset
    20
  public int stringWidth(String str) {
689868b99bde eliminated dependencies on AWT for batch mode
kleing
parents:
diff changeset
    21
    return fontMetrics.stringWidth(str);
689868b99bde eliminated dependencies on AWT for batch mode
kleing
parents:
diff changeset
    22
  }
689868b99bde eliminated dependencies on AWT for batch mode
kleing
parents:
diff changeset
    23
689868b99bde eliminated dependencies on AWT for batch mode
kleing
parents:
diff changeset
    24
  public int getAscent() {
689868b99bde eliminated dependencies on AWT for batch mode
kleing
parents:
diff changeset
    25
    return fontMetrics.getAscent();
689868b99bde eliminated dependencies on AWT for batch mode
kleing
parents:
diff changeset
    26
  }
689868b99bde eliminated dependencies on AWT for batch mode
kleing
parents:
diff changeset
    27
689868b99bde eliminated dependencies on AWT for batch mode
kleing
parents:
diff changeset
    28
  public int getDescent() {
689868b99bde eliminated dependencies on AWT for batch mode
kleing
parents:
diff changeset
    29
    return fontMetrics.getDescent();
689868b99bde eliminated dependencies on AWT for batch mode
kleing
parents:
diff changeset
    30
  }
689868b99bde eliminated dependencies on AWT for batch mode
kleing
parents:
diff changeset
    31
}