org.apache.batik.gvt.font

Class SVGGVTGlyphVector

public final class SVGGVTGlyphVector extends Object implements GVTGlyphVector

A GVTGlyphVector class for SVG fonts.
Field Summary
static AttributePAINT_INFO
Constructor Summary
SVGGVTGlyphVector(GVTFont font, Glyph[] glyphs, FontRenderContext frc)
Constructs an SVGGVTGlyphVector.
Method Summary
voiddraw(Graphics2D graphics2D, AttributedCharacterIterator aci)
Draws this glyph vector.
Rectangle2DgetBounds2D(AttributedCharacterIterator aci)
Returns a tight bounds on the GylphVector including stroking.
intgetCharacterCount(int startGlyphIndex, int endGlyphIndex)
Returns the number of chars represented by the glyphs within the specified range.
GVTFontgetFont()
Returns the Font associated with this GlyphVector.
FontRenderContextgetFontRenderContext()
Returns the FontRenderContext associated with this GlyphVector.
Rectangle2DgetGeometricBounds()
Returns the geometric bounds of this GlyphVector.
Rectangle2DgetGlyphCellBounds(int glyphIndex)
Returns the bounding box of the specified glyph, considering only the glyph's metrics (ascent, descent, advance) rather than the actual glyph shape.
intgetGlyphCode(int glyphIndex)
Returns the glyphcode of the specified glyph.
int[]getGlyphCodes(int beginGlyphIndex, int numEntries, int[] codeReturn)
Returns an array of glyphcodes for the specified glyphs.
GlyphJustificationInfogetGlyphJustificationInfo(int glyphIndex)
Returns the justification information for the glyph at the specified index into this GlyphVector.
ShapegetGlyphLogicalBounds(int glyphIndex)
Returns the logical bounds of the specified glyph within this GlyphVector.
GVTGlyphMetricsgetGlyphMetrics(int idx)
Returns the metrics of the glyph at the specified index into this GlyphVector.
ShapegetGlyphOutline(int glyphIndex)
Returns a Shape whose interior corresponds to the visual representation of the specified glyph within this GlyphVector.
Point2DgetGlyphPosition(int glyphIndex)
Returns the position of the specified glyph within this GlyphVector.
float[]getGlyphPositions(int beginGlyphIndex, int numEntries, float[] positionReturn)
Returns an array of glyph positions for the specified glyphs
AffineTransformgetGlyphTransform(int glyphIndex)
Gets the transform of the specified glyph within this GlyphVector.
ShapegetGlyphVisualBounds(int glyphIndex)
Returns the visual bounds of the specified glyph within the GlyphVector.
Rectangle2DgetLogicalBounds()
Returns the logical bounds of this GlyphVector.
intgetNumGlyphs()
Returns the number of glyphs in this GlyphVector.
ShapegetOutline()
Returns a Shape whose interior corresponds to the visual representation of this GlyphVector.
ShapegetOutline(float x, float y)
Returns a Shape whose interior corresponds to the visual representation of this GlyphVector, offset to x, y.
booleanisGlyphVisible(int glyphIndex)
Returns true if specified glyph will be rendered.
voidperformDefaultLayout()
Assigns default positions to each glyph in this GlyphVector.
voidsetGlyphPosition(int glyphIndex, Point2D newPos)
Sets the position of the specified glyph within this GlyphVector.
voidsetGlyphTransform(int glyphIndex, AffineTransform newTX)
Sets the transform of the specified glyph within this GlyphVector.
voidsetGlyphVisible(int glyphIndex, boolean visible)
Tells the glyph vector whether or not to draw the specified glyph.

Field Detail

PAINT_INFO

public static final Attribute PAINT_INFO

Constructor Detail

SVGGVTGlyphVector

public SVGGVTGlyphVector(GVTFont font, Glyph[] glyphs, FontRenderContext frc)
Constructs an SVGGVTGlyphVector.

Parameters: font The font that is creating this glyph vector. glyphs An array containing the glyphs that form the basis for this glyph vector. frc The current font render context.

Method Detail

draw

public void draw(Graphics2D graphics2D, AttributedCharacterIterator aci)
Draws this glyph vector.

getBounds2D

public Rectangle2D getBounds2D(AttributedCharacterIterator aci)
Returns a tight bounds on the GylphVector including stroking.

getCharacterCount

public int getCharacterCount(int startGlyphIndex, int endGlyphIndex)
Returns the number of chars represented by the glyphs within the specified range.

Parameters: startGlyphIndex The index of the first glyph in the range. endGlyphIndex The index of the last glyph in the range.

Returns: The number of chars.

getFont

public GVTFont getFont()
Returns the Font associated with this GlyphVector.

getFontRenderContext

public FontRenderContext getFontRenderContext()
Returns the FontRenderContext associated with this GlyphVector.

getGeometricBounds

public Rectangle2D getGeometricBounds()
Returns the geometric bounds of this GlyphVector. The geometric bounds is the tightest rectangle enclosing the geometry of the glyph vector (not including stroke).

getGlyphCellBounds

public Rectangle2D getGlyphCellBounds(int glyphIndex)
Returns the bounding box of the specified glyph, considering only the glyph's metrics (ascent, descent, advance) rather than the actual glyph shape.

getGlyphCode

public int getGlyphCode(int glyphIndex)
Returns the glyphcode of the specified glyph.

getGlyphCodes

public int[] getGlyphCodes(int beginGlyphIndex, int numEntries, int[] codeReturn)
Returns an array of glyphcodes for the specified glyphs.

getGlyphJustificationInfo

public GlyphJustificationInfo getGlyphJustificationInfo(int glyphIndex)
Returns the justification information for the glyph at the specified index into this GlyphVector.

getGlyphLogicalBounds

public Shape getGlyphLogicalBounds(int glyphIndex)
Returns the logical bounds of the specified glyph within this GlyphVector.

getGlyphMetrics

public GVTGlyphMetrics getGlyphMetrics(int idx)
Returns the metrics of the glyph at the specified index into this GlyphVector.

getGlyphOutline

public Shape getGlyphOutline(int glyphIndex)
Returns a Shape whose interior corresponds to the visual representation of the specified glyph within this GlyphVector.

getGlyphPosition

public Point2D getGlyphPosition(int glyphIndex)
Returns the position of the specified glyph within this GlyphVector.

getGlyphPositions

public float[] getGlyphPositions(int beginGlyphIndex, int numEntries, float[] positionReturn)
Returns an array of glyph positions for the specified glyphs

getGlyphTransform

public AffineTransform getGlyphTransform(int glyphIndex)
Gets the transform of the specified glyph within this GlyphVector.

getGlyphVisualBounds

public Shape getGlyphVisualBounds(int glyphIndex)
Returns the visual bounds of the specified glyph within the GlyphVector.

getLogicalBounds

public Rectangle2D getLogicalBounds()
Returns the logical bounds of this GlyphVector. This is a bound useful for hit detection and highlighting.

getNumGlyphs

public int getNumGlyphs()
Returns the number of glyphs in this GlyphVector.

getOutline

public Shape getOutline()
Returns a Shape whose interior corresponds to the visual representation of this GlyphVector.

getOutline

public Shape getOutline(float x, float y)
Returns a Shape whose interior corresponds to the visual representation of this GlyphVector, offset to x, y.

isGlyphVisible

public boolean isGlyphVisible(int glyphIndex)
Returns true if specified glyph will be rendered.

performDefaultLayout

public void performDefaultLayout()
Assigns default positions to each glyph in this GlyphVector. The default layout is horizontal.

setGlyphPosition

public void setGlyphPosition(int glyphIndex, Point2D newPos)
Sets the position of the specified glyph within this GlyphVector.

setGlyphTransform

public void setGlyphTransform(int glyphIndex, AffineTransform newTX)
Sets the transform of the specified glyph within this GlyphVector.

setGlyphVisible

public void setGlyphVisible(int glyphIndex, boolean visible)
Tells the glyph vector whether or not to draw the specified glyph.
Copyright B) 2008 Apache Software Foundation. All Rights Reserved.