|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--java.awt.FontMetrics
A font metrics object. Note that the implementations of these methods are inefficient, they are usually overridden with more efficient toolkit specific implementations.
Field Summary | |
protected Font |
font
The actual font. |
Constructor Summary | |
protected |
FontMetrics(Font font)
Creates a new FontMetrics object with the specified font. |
Method Summary | |
int |
bytesWidth(byte[] data,
int off,
int len)
Returns the total advance width for showing the specified array of bytes in this Font. |
int |
charsWidth(char[] data,
int off,
int len)
Returns the total advance width for showing the specified array of characters in this Font. |
int |
charWidth(char ch)
Returns the advance width of the specified character in this Font. |
int |
charWidth(int ch)
Returns the advance width of the specified character in this Font. |
int |
getAscent()
Gets the font ascent. |
int |
getDescent()
Gets the font descent. |
Font |
getFont()
Gets the font. |
int |
getHeight()
Gets the standard height of a line of text in this font. |
int |
getLeading()
Gets the standard leading, or line spacing, for the font. |
int |
getMaxAdvance()
Gets the maximum advance width of any character in this Font. |
int |
getMaxAscent()
Gets the maximum ascent of all characters in this Font. |
int |
getMaxDecent()
For backward compatibility only. |
int |
getMaxDescent()
Gets the maximum descent of all characters in this Font. |
int[] |
getWidths()
Gets the advance widths of the first 256 characters in the Font. |
int |
stringWidth(String str)
Returns the total advance width for showing the specified String in this Font. |
String |
toString()
Returns the String representation of this FontMetric's values. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
protected Font font
getFont()
Constructor Detail |
protected FontMetrics(Font font)
font
- the fontFont
Method Detail |
public Font getFont()
public int getLeading()
public int getAscent()
getMaxAscent()
public int getDescent()
getMaxDescent()
public int getHeight()
public int getMaxAscent()
getAscent()
public int getMaxDescent()
getDescent()
public int getMaxDecent()
getMaxDescent()
public int getMaxAdvance()
public int charWidth(int ch)
ch
- the character to be measuredstringWidth(java.lang.String)
public int charWidth(char ch)
ch
- the character to be measuredstringWidth(java.lang.String)
public int stringWidth(String str)
str
- the String to be measuredcharsWidth(char[], int, int)
,
bytesWidth(byte[], int, int)
public int charsWidth(char[] data, int off, int len)
data
- the array of characters to be measuredoff
- the start offset of the characters in the arraylen
- the number of characters to be measured from the arraystringWidth(java.lang.String)
,
bytesWidth(byte[], int, int)
public int bytesWidth(byte[] data, int off, int len)
data
- the array of bytes to be measuredoff
- the start offset of the bytes in the arraylen
- the number of bytes to be measured from the arraystringWidth(java.lang.String)
,
charsWidth(char[], int, int)
public int[] getWidths()
public String toString()
toString
in class Object
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |