Methods Summary |
---|
public int | bytesWidth(byte[] data, int off, int len)Returns the distance from the leftmost point to the rightmost point on
the string's baseline showing the specified array of bytes in this Font.
int width = 0;
if ((off >= data.length) || (off < 0)) {
// awt.13B=offset off is out of range
throw new IllegalArgumentException(Messages.getString("awt.13B")); //$NON-NLS-1$
}
if ((off + len > data.length)) {
// awt.13C=number of elemets len is out of range
throw new IllegalArgumentException(Messages.getString("awt.13C")); //$NON-NLS-1$
}
for (int i = off; i < off + len; i++) {
width += charWidth(data[i]);
}
return width;
|
public int | charWidth(int ch)Returns the distance from the leftmost point to the rightmost point of
the specified character in this Font.
return 0;
|
public int | charWidth(char ch)Returns the distance from the leftmost point to the rightmost point of
the specified character in this Font.
return 0;
|
public int | charsWidth(char[] data, int off, int len)Returns the distance from the leftmost point to the rightmost point on
the string's baseline showing the specified array of characters in this
Font.
int width = 0;
if ((off >= data.length) || (off < 0)) {
// awt.13B=offset off is out of range
throw new IllegalArgumentException(Messages.getString("awt.13B")); //$NON-NLS-1$
}
if ((off + len > data.length)) {
// awt.13C=number of elemets len is out of range
throw new IllegalArgumentException(Messages.getString("awt.13C")); //$NON-NLS-1$
}
for (int i = off; i < off + len; i++) {
width += charWidth(data[i]);
}
return width;
|
public int | getAscent()Gets the font ascent of the Font associated with this FontMetrics. The
font ascent is the distance from the font's baseline to the top of most
alphanumeric characters.
return 0;
|
public int | getDescent()Gets the font descent of the Font associated with this FontMetrics. The
font descent is the distance from the font's baseline to the bottom of
most alphanumeric characters with descenders.
return 0;
|
private java.awt.font.FontRenderContext | getFRCFromGraphics(java.awt.Graphics context)Returns a FontRenderContext instance of the Graphics context specified.
FontRenderContext frc;
if (context instanceof Graphics2D) {
frc = ((Graphics2D)context).getFontRenderContext();
} else {
frc = new FontRenderContext(null, false, false);
}
return frc;
|
public java.awt.Font | getFont()Gets the font associated with this FontMetrics.
return font;
|
public int | getHeight()Gets the height of the text line in this Font.
return this.getAscent() + this.getDescent() + this.getLeading();
|
public int | getLeading()Gets the leading of the Font associated with this FontMetrics.
return 0;
|
public java.awt.font.LineMetrics | getLineMetrics(char[] chars, int beginIndex, int limit, java.awt.Graphics context)Gets the LineMetrics object for the specified character array in the
specified Graphics.
return font.getLineMetrics(chars, beginIndex, limit, this.getFRCFromGraphics(context));
|
public java.awt.font.LineMetrics | getLineMetrics(java.lang.String str, int beginIndex, int limit, java.awt.Graphics context)Gets the LineMetrics object for the specified String in the specified
Graphics.
return font.getLineMetrics(str, beginIndex, limit, this.getFRCFromGraphics(context));
|
public java.awt.font.LineMetrics | getLineMetrics(java.text.CharacterIterator ci, int beginIndex, int limit, java.awt.Graphics context)Gets the LineMetrics object for the specified CharacterIterator in the
specified Graphics.
return font.getLineMetrics(ci, beginIndex, limit, this.getFRCFromGraphics(context));
|
public java.awt.font.LineMetrics | getLineMetrics(java.lang.String str, java.awt.Graphics context)Gets the LineMetrics object for the specified String in the specified
Graphics.
return font.getLineMetrics(str, this.getFRCFromGraphics(context));
|
public int | getMaxAdvance()Gets the maximum advance width of character in this Font.
return 0;
|
public int | getMaxAscent()Gets the maximum font ascent of the Font associated with this
FontMetrics.
return 0;
|
public java.awt.geom.Rectangle2D | getMaxCharBounds(java.awt.Graphics context)Returns the character's maximum bounds in the specified Graphics context.
return this.font.getMaxCharBounds(this.getFRCFromGraphics(context));
|
public int | getMaxDecent()Gets the maximum font descent of character in this Font.
return 0;
|
public int | getMaxDescent()Gets the maximum font descent of character in this Font.
return 0;
|
public java.awt.geom.Rectangle2D | getStringBounds(java.text.CharacterIterator ci, int beginIndex, int limit, java.awt.Graphics context)Gets the bounds of the specified CharacterIterator in the specified
Graphics context.
return font.getStringBounds(ci, beginIndex, limit, this.getFRCFromGraphics(context));
|
public java.awt.geom.Rectangle2D | getStringBounds(java.lang.String str, int beginIndex, int limit, java.awt.Graphics context)Gets the bounds of the specified String in the specified Graphics
context.
return font.getStringBounds(str, beginIndex, limit, this.getFRCFromGraphics(context));
|
public java.awt.geom.Rectangle2D | getStringBounds(char[] chars, int beginIndex, int limit, java.awt.Graphics context)Gets the bounds of the specified characters array in the specified
Graphics context.
return font.getStringBounds(chars, beginIndex, limit, this.getFRCFromGraphics(context));
|
public java.awt.geom.Rectangle2D | getStringBounds(java.lang.String str, java.awt.Graphics context)Gets the bounds of the specified String in the specified Graphics
context.
return font.getStringBounds(str, this.getFRCFromGraphics(context));
|
public int[] | getWidths()Gets the advance widths of the characters in the Font.
return null;
|
public boolean | hasUniformLineMetrics()Checks if the Font has uniform line metrics or not. The Font can contain
characters of other fonts for covering character set. In this case the
Font isn't uniform.
return this.font.hasUniformLineMetrics();
|
public int | stringWidth(java.lang.String str)Returns the advance width for the specified String in this Font.
return 0;
|
public java.lang.String | toString()Returns the String representation of this FontMetrics.
return this.getClass().getName() + "[font=" + this.getFont() + //$NON-NLS-1$
"ascent=" + this.getAscent() + //$NON-NLS-1$
", descent=" + this.getDescent() + //$NON-NLS-1$
", height=" + this.getHeight() + "]"; //$NON-NLS-1$ //$NON-NLS-2$
|