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
Glyph(java.lang.String unicode, java.util.Vector 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, float kernScale, java.awt.Paint fillPaint, java.awt.Paint strokePaint, java.awt.Stroke stroke, java.awt.Shape dShape, GraphicsNode glyphChildrenNode)
          Constructs a Glyph with the specified parameters.
 
Method Summary
 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 metics 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.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Glyph

public Glyph(java.lang.String unicode,
             java.util.Vector 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,
             float kernScale,
             java.awt.Paint fillPaint,
             java.awt.Paint strokePaint,
             java.awt.Stroke stroke,
             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 glpyh can be use 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:
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 metics of this Glyph with the specified kerning value applied.
Parameters:
kern - The kerning 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.
context - The current rendering context.


Copyright © 2002 Apache Software Foundation. All Rights Reserved.