Class java.awt.font.GraphicAttribute
java.lang.Object
|
+----java.awt.font.GraphicAttribute
- Subclasses:
- ImageGraphicAttribute, ShapeGraphicAttribute
- public abstract class GraphicAttribute
- extends Object
This is the base class for the attribute which indicates a
graphic embedded in text. Clients can subclass this class
to implement their own graphics. Clients wishing to embed
Shapes and Images in text need not subclass this class;
they can use the ShapeGraphicAttribute
and ImageGraphicAttribute classes instead.
Subclasses should ensure that their subclasses are immutable
(that is, that the class does not change once it has been
constructed). Mutating a GraphicAttribute which is used in
a TextLayout results in undefined behavior from the TextLayout.
Method Summary
|
void
|
draw(Graphics2D graphics,
float x,
float y)
Draw the graphic at the given location.
|
float
|
getAdvance()
Return the advance of this graphic.
|
int
|
getAlignment()
Return the alignment of this graphic.
|
float
|
getAscent()
Return the ascent of this graphic.
|
Rectangle2D
|
getBounds()
The rectangle returned from this method should enclose all of the
bits drawn by this graphic (relative to the drawing position, of
course).
|
float
|
getDescent()
Return the descent of this graphic.
|
GlyphJustificationInfo
|
getJustificationInfo()
Return the justification information for this graphic.
|
Methods inherited from class java.lang.Object
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
TOP_ALIGNMENT
public static final int TOP_ALIGNMENT
BOTTOM_ALIGNMENT
public static final int BOTTOM_ALIGNMENT
ROMAN_BASELINE
public static final int ROMAN_BASELINE
CENTER_BASELINE
public static final int CENTER_BASELINE
HANGING_BASELINE
public static final int HANGING_BASELINE
GraphicAttribute
protected GraphicAttribute(int alignment)
getAscent
public abstract float getAscent()
- Return the ascent of this graphic. A graphic can draw above its ascent
(see getBounds).
getDescent
public abstract float getDescent()
- Return the descent of this graphic. A graphic can draw below its descent
(see getBounds).
getAdvance
public abstract float getAdvance()
- Return the advance of this graphic. A graphic can draw beyond its advance
(see getBounds).
getBounds
public Rectangle2D getBounds()
- The rectangle returned from this method should enclose all of the
bits drawn by this graphic (relative to the drawing position, of
course). A graphic may draw beyond its ascent, descent, or advance;
but if it does, this method's implementation should indicate where
the graphic draws.
Default bounds is the rectangle (0, -ascent, advance, ascent+descent).
draw
public abstract void draw(Graphics2D graphics,
float x,
float y)
- Draw the graphic at the given location.
getAlignment
public final int getAlignment()
- Return the alignment of this graphic. Alignment can be to a particular
baseline, or to the absolute top or bottom of a TextLayout.
getJustificationInfo
public GlyphJustificationInfo getJustificationInfo()
- Return the justification information for this graphic. Subclasses
can override to provide different justification information.
Submit a bug or feature
Submit comments/suggestions about new javadoc look.
Java is a trademark or registered trademark of Sun Microsystems, Inc. in the US and other countries.
Copyright 1993-1998 Sun Microsystems, Inc. 901 San Antonio Road, Palo Alto, California, 94303, U.S.A. All Rights Reserved.