All Packages Class Hierarchy This Package Previous Next Index
Class java.awt.FontMetrics
java.lang.Object
|
+----java.awt.FontMetrics
- public class FontMetrics
- extends Object
- implements Serializable
A font metrics object. Note that the implementations of these
methods are inefficient, they are usually overridden with more
efficient toolkit specific implementations.
-
font
- The actual font.
-
FontMetrics(Font)
- Creates a new FontMetrics object with the specified font.
-
bytesWidth(byte[], int, int)
-
Returns the total advance width for showing the specified array
of bytes in this Font.
-
charsWidth(char[], int, int)
-
Returns the total advance width for showing the specified array
of characters in this Font.
-
charWidth(char)
-
Returns the advance width of the specified character in this Font.
-
charWidth(int)
-
Returns the advance width of the specified character in this Font.
-
getAscent()
- Gets the font ascent.
-
getDescent()
- Gets the font descent.
-
getFont()
- Gets the font.
-
getHeight()
- Gets the standard height of a line of text in this font.
-
getLeading()
- Gets the standard leading, or line spacing, for the font.
-
getMaxAdvance()
- Gets the maximum advance width of any character in this Font.
-
getMaxAscent()
- Gets the maximum ascent of all characters in this Font.
-
getMaxDecent()
- For backward compatibility only.
-
getMaxDescent()
- Gets the maximum descent of all characters in this Font.
-
getWidths()
- Gets the advance widths of the first 256 characters in the Font.
-
stringWidth(String)
-
Returns the total advance width for showing the specified String
in this Font.
-
toString()
-
Returns the String representation of this FontMetric's values.
font
Properties Inheritable
font=Font
- The actual font.
- See Also:
- getFont
FontMetrics
method FontMetrics(font=Font) Inheritable
- Creates a new FontMetrics object with the specified font.
- Parameters:
- font - the font
- See Also:
- Font
getFont
method getFont() returns Font public
- Gets the font.
getLeading
method getLeading() returns int public
- Gets the standard leading, or line spacing, for the font.
This is 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.
getAscent
method getAscent() returns int public
- Gets the font ascent. The font ascent is the distance from the
base line to the top of most Alphanumeric characters. Note,
however, that some characters in the font may extend above
this height.
- See Also:
- getMaxAscent
getDescent
method getDescent() returns int public
- Gets the font descent. The font descent is the distance from the
base line to the bottom of most Alphanumeric characters. Note,
however, that some characters in the font may extend below this
height.
- See Also:
- getMaxDescent
getHeight
method getHeight() returns int public
- Gets the standard height of a line of text in this font. This
is the distance between the baseline of adjacent lines of text.
It is the sum of the leading + ascent + descent. There is no
guarantee that lines of text spaced at this distance will be
disjoint; such lines may overlap if some characters overshoot
either the standard ascent or the standard descent metric.
getMaxAscent
method getMaxAscent() returns int public
- Gets the maximum ascent of all characters in this Font.
No character will extend further above the baseline than this
distance.
- See Also:
- getAscent
getMaxDescent
method getMaxDescent() returns int public
- Gets the maximum descent of all characters in this Font.
No character will descend futher below the baseline than this
distance.
- See Also:
- getDescent
getMaxDecent
method getMaxDecent() returns int public
- For backward compatibility only.
- See Also:
- getMaxDescent
getMaxAdvance
method getMaxAdvance() returns int public
- Gets the maximum advance width of any character in this Font.
The advance width is the amount by which the current point is
moved from one character to the next in a line of text.
- Returns:
- -1 if the max advance is not known.
charWidth
method charWidth(ch=int) returns int public
- Returns the advance width of the specified character in this Font.
The advance width is the amount by which the current point is
moved from one character to the next in a line of text.
- Parameters:
- ch - the character to be measured
- See Also:
- stringWidth
charWidth
method charWidth(ch=char) returns int public
- Returns the advance width of the specified character in this Font.
The advance width is the amount by which the current point is
moved from one character to the next in a line of text.
- Parameters:
- ch - the character to be measured
- See Also:
- stringWidth
stringWidth
method stringWidth(str=String) returns int public
- Returns the total advance width for showing the specified String
in this Font.
The advance width is the amount by which the current point is
moved from one character to the next in a line of text.
- Parameters:
- str - the String to be measured
- See Also:
- charsWidth, bytesWidth
charsWidth
method charsWidth(data=char[], -
off=int, -
len=int) returns int public
- Returns the total advance width for showing the specified array
of characters in this Font.
The advance width is the amount by which the current point is
moved from one character to the next in a line of text.
- Parameters:
- data - the array of characters to be measured
- off - the start offset of the characters in the array
- len - the number of characters to be measured from the array
- See Also:
- stringWidth, bytesWidth
bytesWidth
method bytesWidth(data=byte[], -
off=int, -
len=int) returns int public
- Returns the total advance width for showing the specified array
of bytes in this Font.
The advance width is the amount by which the current point is
moved from one character to the next in a line of text.
- Parameters:
- data - the array of bytes to be measured
- off - the start offset of the bytes in the array
- len - the number of bytes to be measured from the array
- See Also:
- stringWidth, charsWidth
getWidths
method getWidths() returns int[] public
- Gets the advance widths of the first 256 characters in the Font.
The advance width is the amount by which the current point is
moved from one character to the next in a line of text.
toString
method toString() returns String public
- Returns the String representation of this FontMetric's values.
- Overrides:
- toString in class Object
All Packages Class Hierarchy This Package Previous Next Index