Methods Summary |
---|
public abstract void | draw(java.awt.Graphics2D graphics, float x, float y)Draws the GraphicAttribute at the specified location.
|
public abstract float | getAdvance()Gets the GraphicAttribute's advance. It's the distance from the point at
which the graphic is rendered and the point where the next character or
graphic is rendered.
|
public final int | getAlignment()Gets the alignment of this GraphicAttribute.
return this.alignment;
|
public abstract float | getAscent()Gets the ascent of this GraphicAttribute.
|
public java.awt.geom.Rectangle2D | getBounds()Gets the bounds of this GraphicAttribute.
float ascent = getAscent();
float advance = getAdvance();
float descent = getDescent();
// Default implementation - see API documentation.
return new Rectangle2D.Float(0, -ascent, advance, ascent + descent);
|
public abstract float | getDescent()Gets the descent of this GraphicAttribute.
|
public java.awt.font.GlyphJustificationInfo | getJustificationInfo()Gets the GlyphJustificationInfo of this GraphicAttribute.
/*
* Default implementation. Since documentation doesn't describe default
* values, they were calculated based on 1.5 release behavior and can be
* obtained using next test sample: // Create GraphicAttribute class
* implementation public class MyGraphicAttribute extends
* GraphicAttribute { protected MyGraphicAttribute(int align) {
* super(align); } public float getDescent() { return 0; } public float
* getAdvance() { return 1; } public void draw(Graphics2D g2, float x,
* float y) { } public float getAscent() { return 0; } }
* MyGraphicAttribute myGA = gat.new MyGraphicAttribute(0); // print
* justification parameters
* System.out.println(myGA.getJustificationInfo().growAbsorb);
* System.out.println(myGA.getJustificationInfo().shrinkAbsorb);
* System.out.println(myGA.getJustificationInfo().growLeftLimit);
* System.out.println(myGA.getJustificationInfo().growPriority);
* System.out.println(myGA.getJustificationInfo().growRightLimit);
* System.out.println(myGA.getJustificationInfo().shrinkLeftLimit);
* System.out.println(myGA.getJustificationInfo().shrinkPriority);
* System.out.println(myGA.getJustificationInfo().shrinkRightLimit);
* System.out.println(myGA.getJustificationInfo().weight);
*/
float advance = getAdvance();
return new GlyphJustificationInfo(advance, false,
GlyphJustificationInfo.PRIORITY_INTERCHAR, advance / 3, advance / 3, false,
GlyphJustificationInfo.PRIORITY_WHITESPACE, 0, 0);
|