org.apache.batik.gvt.font

Class Glyph

public class Glyph extends Object

A Glyph describes a graphics node with some specific glyph rendering attributes.
Constructor Summary
Glyph(String unicode, List names, String orientation, String arabicForm, String lang, Point2D horizOrigin, Point2D vertOrigin, float horizAdvX, float vertAdvY, int glyphCode, TextPaintInfo tpi, Shape dShape, GraphicsNode glyphChildrenNode)
Constructs a Glyph with the specified parameters.
Method Summary
voiddraw(Graphics2D graphics2D)
Draws this glyph.
StringgetArabicForm()
Returns which of the four possible arabic forms this glyph represents.
Rectangle2DgetBounds2D()
Rectangle2DgetGeometryBounds()
intgetGlyphCode()
Returns the glyphs unique code with resect to its font.
GVTGlyphMetricsgetGlyphMetrics()
Returns the metrics of this Glyph if it is used in a horizontal layout.
GVTGlyphMetricsgetGlyphMetrics(float hkern, float vkern)
Returns the metics of this Glyph with the specified kerning value applied.
floatgetHorizAdvX()
Returns the horizontal advance value.
Point2DgetHorizOrigin()
Returns the horizontal origin of this glyph.
StringgetLang()
Returns a comma separated list of languages this glyph can be used in.
VectorgetNames()
Returns the names of this glyph.
StringgetOrientation()
Returns the orientation of this glyph.
ShapegetOutline()
Returns the outline of this glyph.
Point2DgetPosition()
Returns the position of this glyph.
AffineTransformgetTransform()
Returns the glpyh's transform.
StringgetUnicode()
Returns the unicode char or chars this glyph represents.
floatgetVertAdvY()
Returns the vertical advance value.
Point2DgetVertOrigin()
Returns the vertical origin of this glyph.
voidsetPosition(Point2D position)
Sets the position of the glyph.
voidsetTransform(AffineTransform transform)
Sets the transform to be applied to this glyph.

Constructor Detail

Glyph

public Glyph(String unicode, List names, String orientation, String arabicForm, String lang, Point2D horizOrigin, Point2D vertOrigin, float horizAdvX, float vertAdvY, int glyphCode, TextPaintInfo tpi, Shape dShape, GraphicsNode glyphChildrenNode)
Constructs a Glyph with the specified parameters.

Method Detail

draw

public void draw(Graphics2D graphics2D)
Draws this glyph.

Parameters: graphics2D The Graphics2D object to draw to.

getArabicForm

public String getArabicForm()
Returns which of the four possible arabic forms this glyph represents. This is only used for arabic glyphs.

Returns: The glyphs arabic form.

getBounds2D

public Rectangle2D getBounds2D()

getGeometryBounds

public Rectangle2D getGeometryBounds()

getGlyphCode

public int getGlyphCode()
Returns the glyphs unique code with resect to its font. This will be the index into the font's list of glyphs.

Returns: The glyph's unique code.

getGlyphMetrics

public GVTGlyphMetrics getGlyphMetrics()
Returns the metrics of this Glyph if it is used in a horizontal layout.

Returns: The glyph metrics.

getGlyphMetrics

public GVTGlyphMetrics getGlyphMetrics(float hkern, float vkern)
Returns the metics of this Glyph with the specified kerning value applied.

Parameters: hkern The horizontal kerning value to apply when calculating the glyph metrics. vkern The horizontal vertical value to apply when calculating the glyph metrics.

Returns: The kerned glyph metics

getHorizAdvX

public float getHorizAdvX()
Returns the horizontal advance value.

Returns: This glyph's horizontal advance.

getHorizOrigin

public Point2D getHorizOrigin()
Returns the horizontal origin of this glyph.

Returns: The horizontal origin.

getLang

public String getLang()
Returns a comma separated list of languages this glyph can be used in.

Returns: The glyph languages.

getNames

public Vector getNames()
Returns the names of this glyph.

Returns: The glyph names.

getOrientation

public String getOrientation()
Returns the orientation of this glyph. Indicates what inline-progression-direction this glyph can be used in. Should be either "h" for horizontal only, "v" for vertical only, or empty which indicates that the glyph can be used in both.

Returns: The glyph orientation.

getOutline

public Shape getOutline()
Returns the outline of this glyph. This will be positioned correctly and any glyph transforms will have been applied.

Returns: the outline of this glyph.

getPosition

public Point2D getPosition()
Returns the position of this glyph.

Returns: The glyph's position.

getTransform

public AffineTransform getTransform()
Returns the glpyh's transform.

Returns: The glyph's transform.

getUnicode

public String getUnicode()
Returns the unicode char or chars this glyph represents.

Returns: The glyphs unicode value.

getVertAdvY

public float getVertAdvY()
Returns the vertical advance value.

Returns: the glyph's vertical advance.

getVertOrigin

public Point2D getVertOrigin()
Returns the vertical origin of this glyph.

Returns: The vertical origin.

setPosition

public void setPosition(Point2D position)
Sets the position of the glyph.

Parameters: position The new glyph position.

setTransform

public void setTransform(AffineTransform transform)
Sets the transform to be applied to this glyph.

Parameters: transform The transform to set.

Copyright B) 2007 Apache Software Foundation. All Rights Reserved.