Package org.apache.batik.gvt.font
Class Glyph
- java.lang.Object
-
- org.apache.batik.gvt.font.Glyph
-
public class Glyph extends java.lang.Object
A Glyph describes a graphics node with some specific glyph rendering attributes.
-
-
Constructor Summary
Constructors Constructor Description Glyph(java.lang.String unicode, java.util.List names, java.lang.String orientation, java.lang.String arabicForm, java.lang.String lang, java.awt.geom.Point2D horizOrigin, java.awt.geom.Point2D vertOrigin, float horizAdvX, float vertAdvY, int glyphCode, TextPaintInfo tpi, java.awt.Shape dShape, GraphicsNode glyphChildrenNode)
Constructs a Glyph with the specified parameters.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
draw(java.awt.Graphics2D graphics2D)
Draws this glyph.java.lang.String
getArabicForm()
Returns which of the four possible arabic forms this glyph represents.java.awt.geom.Rectangle2D
getBounds2D()
java.awt.geom.Rectangle2D
getGeometryBounds()
int
getGlyphCode()
Returns the glyphs unique code with resect to its font.GVTGlyphMetrics
getGlyphMetrics()
Returns the metrics of this Glyph if it is used in a horizontal layout.GVTGlyphMetrics
getGlyphMetrics(float hkern, float vkern)
Returns the metrics of this Glyph with the specified kerning value applied.float
getHorizAdvX()
Returns the horizontal advance value.java.awt.geom.Point2D
getHorizOrigin()
Returns the horizontal origin of this glyph.java.lang.String
getLang()
Returns a comma separated list of languages this glyph can be used in.java.util.Vector
getNames()
Returns the names of this glyph.java.lang.String
getOrientation()
Returns the orientation of this glyph.java.awt.Shape
getOutline()
Returns the outline of this glyph.java.awt.geom.Point2D
getPosition()
Returns the position of this glyph.java.awt.geom.AffineTransform
getTransform()
Returns the glpyh's transform.java.lang.String
getUnicode()
Returns the unicode char or chars this glyph represents.float
getVertAdvY()
Returns the vertical advance value.java.awt.geom.Point2D
getVertOrigin()
Returns the vertical origin of this glyph.void
setPosition(java.awt.geom.Point2D position)
Sets the position of the glyph.void
setTransform(java.awt.geom.AffineTransform transform)
Sets the transform to be applied to this glyph.
-
-
-
Constructor Detail
-
Glyph
public Glyph(java.lang.String unicode, java.util.List names, java.lang.String orientation, java.lang.String arabicForm, java.lang.String lang, java.awt.geom.Point2D horizOrigin, java.awt.geom.Point2D vertOrigin, float horizAdvX, float vertAdvY, int glyphCode, TextPaintInfo tpi, java.awt.Shape dShape, GraphicsNode glyphChildrenNode)
Constructs a Glyph with the specified parameters.
-
-
Method Detail
-
getUnicode
public java.lang.String getUnicode()
Returns the unicode char or chars this glyph represents.- Returns:
- The glyphs unicode value.
-
getNames
public java.util.Vector getNames()
Returns the names of this glyph.- Returns:
- The glyph names.
-
getOrientation
public java.lang.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.
-
getArabicForm
public java.lang.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.
-
getLang
public java.lang.String getLang()
Returns a comma separated list of languages this glyph can be used in.- Returns:
- The glyph languages.
-
getHorizOrigin
public java.awt.geom.Point2D getHorizOrigin()
Returns the horizontal origin of this glyph.- Returns:
- The horizontal origin.
-
getVertOrigin
public java.awt.geom.Point2D getVertOrigin()
Returns the vertical origin of this glyph.- Returns:
- The vertical origin.
-
getHorizAdvX
public float getHorizAdvX()
Returns the horizontal advance value.- Returns:
- This glyph's horizontal advance.
-
getVertAdvY
public float getVertAdvY()
Returns the vertical advance value.- Returns:
- the glyph's vertical advance.
-
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.
-
getTransform
public java.awt.geom.AffineTransform getTransform()
Returns the glpyh's transform.- Returns:
- The glyph's transform.
-
setTransform
public void setTransform(java.awt.geom.AffineTransform transform)
Sets the transform to be applied to this glyph.- Parameters:
transform
- The transform to set.
-
getPosition
public java.awt.geom.Point2D getPosition()
Returns the position of this glyph.- Returns:
- The glyph's position.
-
setPosition
public void setPosition(java.awt.geom.Point2D position)
Sets the position of the glyph.- Parameters:
position
- The new glyph position.
-
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 metrics 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
-
getGeometryBounds
public java.awt.geom.Rectangle2D getGeometryBounds()
-
getBounds2D
public java.awt.geom.Rectangle2D getBounds2D()
-
getOutline
public java.awt.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.
-
draw
public void draw(java.awt.Graphics2D graphics2D)
Draws this glyph.- Parameters:
graphics2D
- The Graphics2D object to draw to.
-
-