API Overview API Index Package Overview Direct link to this page
JDK 1.6
  java.awt. FontMetrics View Source
Author(s)
Jim Graham
Since
JDK1.0
Version
1.59 11/17/05
Serial
Hierarchy
 Object
      FontMetrics
Implements
 Serializable
Subclasses
Description
publicabstract abstract class FontMetrics
  The FontMetrics class defines a font metrics object, which encapsulates information about the rendering of a particular font on a particular screen.
See also:    Font
Constructors
protected FontMetrics (Font font)
  Creates a new FontMetrics object for finding out height and width information about the specified Font and specific character glyphs in that Font.
Methods
Hide/Show inherited methods
public int bytesWidth (byte[] data, int off, int len)
  Returns the total advance width for showing the specified array of bytes in this Font.
public int charsWidth (char[] data, int off, int len)
  Returns the total advance width for showing the specified array of characters in this Font.
public int charWidth (char ch)
  Returns the advance width of the specified character in this Font.
public int charWidth (int codePoint)
  Returns the advance width of the specified character in this Font.
public int getAscent ()
  Determines the font ascent of the Font described by this FontMetrics object.
public int getDescent ()
  Determines the font descent of the Font described by this FontMetrics object.
public Font getFont ()
  Gets the Font described by this FontMetrics object.
public FontRenderContext getFontRenderContext ()
  Gets the FontRenderContext used by this FontMetrics object to measure text.
public int getHeight ()
  Gets the standard height of a line of text in this font.
public int getLeading ()
  Determines the standard leading of the Font described by this FontMetrics object.
public LineMetrics getLineMetrics (char[] chars, int beginIndex, int limit, Graphics context)
  Returns the LineMetrics object for the specified character array in the specified Graphics context.
public LineMetrics getLineMetrics (CharacterIterator ci, int beginIndex, int limit, Graphics context)
  Returns the LineMetrics object for the specified CharacterIterator in the specified Graphics context.
public LineMetrics getLineMetrics (String str, Graphics context)
  Returns the LineMetrics object for the specified String in the specified Graphics context.
public LineMetrics getLineMetrics (String str, int beginIndex, int limit, Graphics context)
  Returns the LineMetrics object for the specified String in the specified Graphics context.
public int getMaxAdvance ()
  Gets the maximum advance width of any character in this Font.
public int getMaxAscent ()
  Determines the maximum ascent of the Font described by this FontMetrics object.
public Rectangle2D getMaxCharBounds (Graphics context)
  Returns the bounds for the character with the maximum bounds in the specified Graphics context.
@Deprecated
public int getMaxDecent ()
  For backward compatibility only.
public int getMaxDescent ()
  Determines the maximum descent of the Font described by this FontMetrics object.
public Rectangle2D getStringBounds (char[] chars, int beginIndex, int limit, Graphics context)
  Returns the bounds of the specified array of characters in the specified Graphics context.
public Rectangle2D getStringBounds (CharacterIterator ci, int beginIndex, int limit, Graphics context)
  Returns the bounds of the characters indexed in the specified CharacterIterator in the specified Graphics context.
public Rectangle2D getStringBounds (String str, Graphics context)
  Returns the bounds of the specified String in the specified Graphics context.
public Rectangle2D getStringBounds (String str, int beginIndex, int limit, Graphics context)
  Returns the bounds of the specified String in the specified Graphics context.
public int getWidths ()
  Gets the advance widths of the first 256 characters in the Font.
public boolean hasUniformLineMetrics ()
  Checks to see if the Font has uniform line metrics.
public int stringWidth (String str)
  Returns the total advance width for showing the specified String in this Font.
public String toString ()
  Returns a representation of this FontMetrics object's values as a String.
Fields
Hide/Show inherited fields
protected Font font
  The actual Font from which the font metrics are created.
Nested Classes
Generated By: JavaOnTracks Doclet 0.1.4     ©Thibaut Colar