java.awt.font

Class GraphicAttribute

public abstract class GraphicAttribute extends Object

This class represents a graphic embedded in text.
Field Summary
static intBOTTOM_ALIGNMENT
static intCENTER_BASELINE
static intHANGING_BASELINE
static intROMAN_BASELINE
static intTOP_ALIGNMENT
Constructor Summary
protected GraphicAttribute(int alignment)
Constructor.
Method Summary
abstract voiddraw(Graphics2D graphics, float x, float y)
Draws the graphic.
abstract floatgetAdvance()
Gets the distance from the origin of its graphic to the right side of the bounds of its graphic.
intgetAlignment()
Gets the alignment.
abstract floatgetAscent()
Gets the positive distance from the origin of its graphic to the top of bounds.
Rectangle2DgetBounds()
Returns a Rectangle2D that encloses the rendered area.
abstract floatgetDescent()
Gets the distance from the origin of its graphic to the bottom of the bounds.
GlyphJustificationInfogetJustificationInfo()
Returns the justification information for this object.

Field Detail

BOTTOM_ALIGNMENT

public static final int BOTTOM_ALIGNMENT

CENTER_BASELINE

public static final int CENTER_BASELINE

HANGING_BASELINE

public static final int HANGING_BASELINE

ROMAN_BASELINE

public static final int ROMAN_BASELINE

TOP_ALIGNMENT

public static final int TOP_ALIGNMENT

Constructor Detail

GraphicAttribute

protected GraphicAttribute(int alignment)
Constructor.

Parameters: alignment - the alignment to use for the graphic

Method Detail

draw

public abstract void draw(Graphics2D graphics, float x, float y)
Draws the graphic.

Parameters: graphics - the graphics configuration to use x - the x location y - the y location

getAdvance

public abstract float getAdvance()
Gets the distance from the origin of its graphic to the right side of the bounds of its graphic.

Returns: the advance

getAlignment

public final int getAlignment()
Gets the alignment.

Returns: the alignment

getAscent

public abstract float getAscent()
Gets the positive distance from the origin of its graphic to the top of bounds.

Returns: the ascent

getBounds

public Rectangle2D getBounds()
Returns a Rectangle2D that encloses the rendered area. Default bounds is the rectangle (0, -ascent, advance, ascent+descent).

Returns: the bounds of the rendered area

getDescent

public abstract float getDescent()
Gets the distance from the origin of its graphic to the bottom of the bounds.

Returns: the descent

getJustificationInfo

public GlyphJustificationInfo getJustificationInfo()
Returns the justification information for this object.

Returns: the justification information