Class FontMetrics
All Packages  Class Hierarchy  This Package  Previous  Next  Index

Class FontMetrics

public class netscape.application.FontMetrics
    extends java.lang.Object
{
    /* Constructors
     */
    public FontMetrics();
    public FontMetrics(Font);

    /* Methods
     */
    public int ascent();
    public int bytesWidth(byte[], int, int);
    public int charHeight();
    public int charWidth(int);
    public int charWidth(char);
    public int charsWidth(char[], int, int);
    public int descent();
    public Font font();
    public int height();
    public int leading();
    public int maxAdvance();
    public int maxAscent();
    public int maxDescent();
    public int stringHeight();
    public Size stringSize(String);
    public int stringWidth(String);
    public String toString();
    public int[] widthsArray();
    public int widthsArrayBase();
}
Object subclass that manages a Font instance's metrics.

Note: FontMetrics are currently retrieve using the default java.awt.Toolkit, so they contain screen metric information only..


Constructors

FontMetrics

  public FontMetrics()
Constructs a FontMetrics not associated with a Font. This method is only useful when decoding.

FontMetrics

  public FontMetrics(Font aFont)
Creates a FontMetrics associated with aFont.

Methods

font

  public Font font()
Returns the Font associated with this FontMetrics.

leading

  public int leading()
Returns the standard leading (line spacing) for the Font, the logical amount of space to be reserved between the descent of one line of text and the ascent of the next line. The height metric is calculated to include this extra space.

ascent

  public int ascent()
Returns the Font's ascent, the distance from the baseline to the top of the characters.

descent

  public int descent()
Returns the Font's descent, the distance from the baseline to the bottom of the characters.

height

  public int height()
Returns the Font's total height, the distance between the baseline of adjacent lines of text (leading + ascent + descent).

charHeight

  public int charHeight()
Returns the Font's total character height, the distance from the bottom of the descent to the top of the ascent.

maxAscent

  public int maxAscent()
Returns the maximum ascent of all characters in this Font. No character extends further above the baseline than this metric.

maxDescent

  public int maxDescent()
Returns the maximum descent of all characters in this Font. No character descends futher below the baseline than this metric.

maxAdvance

  public int maxAdvance()
Returns the maximum advance width of any character in this Font, or -1 if unknown.

charWidth

  public int charWidth(int aChar)
Returns aChar's width in the FontMetric's Font.

charWidth

  public int charWidth(char aChar)
Returns aChar's width in the FontMetric's Font.

stringWidth

  public int stringWidth(String aString)
Returns aString's width in the FontMetric's Font.

stringHeight

  public int stringHeight()
Returns the height of all strings in the FontMetric's Font. Equivalent to the following code:
    ascent() + descent();

stringSize

  public Size stringSize(String aString)
Returns aString's size in the FontMetric's Font. Equivalent to the following code:
    new Size(stringWidth(aString), stringHeight());

charsWidth

  public int charsWidth(char data[],
                        int offset,
                        int length)
Returns the width of length characters of the array data in the FontMetric's Font, starting at offset within the array.

bytesWidth

  public int bytesWidth(byte data[],
                        int offset,
                        int length)
Returns the width of length bytes of the array data in the FontMetric's Font, starting at offset within the array.

widthsArray

  public int[] widthsArray()
Returns the widths of the first 256 characters in the FontMetric's Font.

widthsArrayBase

  public int widthsArrayBase()
Returns the index of the first glyph in a downloaded Font.

toString

  public String toString()
Returns the FontMetric's string representation.
Overrides:
toString in class Object

All Packages  Class Hierarchy  This Package  Previous  Next  Index