java.awt.font
Class GraphicAttribute

java.lang.Object
  extended by java.awt.font.GraphicAttribute
Direct Known Subclasses:
ImageGraphicAttribute, ShapeGraphicAttribute

public abstract class GraphicAttribute
extends Object

This class represents a graphic embedded in text.


Field Summary
static int BOTTOM_ALIGNMENT
           
static int CENTER_BASELINE
           
static int HANGING_BASELINE
           
static int ROMAN_BASELINE
           
static int TOP_ALIGNMENT
           
 
Constructor Summary
protected GraphicAttribute(int alignment)
          Constructor.
 
Method Summary
abstract  void draw(Graphics2D graphics, float x, float y)
          Draws the graphic.
abstract  float getAdvance()
          Gets the distance from the origin of its graphic to the right side of the bounds of its graphic.
 int getAlignment()
          Gets the alignment.
abstract  float getAscent()
          Gets the positive distance from the origin of its graphic to the top of bounds.
 Rectangle2D getBounds()
          Returns a Rectangle2D that encloses the rendered area.
abstract  float getDescent()
          Gets the distance from the origin of its graphic to the bottom of the bounds.
 GlyphJustificationInfo getJustificationInfo()
          Returns the justification information for this object.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

BOTTOM_ALIGNMENT

public static final int BOTTOM_ALIGNMENT
See Also:
Constant Field Values

CENTER_BASELINE

public static final int CENTER_BASELINE
See Also:
Constant Field Values

HANGING_BASELINE

public static final int HANGING_BASELINE
See Also:
Constant Field Values

ROMAN_BASELINE

public static final int ROMAN_BASELINE
See Also:
Constant Field Values

TOP_ALIGNMENT

public static final int TOP_ALIGNMENT
See Also:
Constant Field Values
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

getAscent

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

Returns:
the ascent

getDescent

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

Returns:
the descent

getAlignment

public final int getAlignment()
Gets the alignment.

Returns:
the alignment

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

getJustificationInfo

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

Returns:
the justification information