Unified Typesetting API M1-20040817

de.inghuimische.uta.test
Class SimpleGlyph

java.lang.Object
  extended byde.inghuimische.uta.typeset.AbstractBox
      extended byde.inghuimische.uta.typeset.AbstractGlyph
          extended byde.inghuimische.uta.test.SimpleGlyph
All Implemented Interfaces:
Box, Glyph

public class SimpleGlyph
extends AbstractGlyph

Simple bean-style implementation of the Glyph interface. Primarily meant for simple implementations and testing purposes.

Author:
Christian Ziesemer

Nested Class Summary
 
Nested classes inherited from class de.inghuimische.uta.typeset.AbstractGlyph
AbstractGlyph.CharacterBuffer
 
Field Summary
protected  Vector anchors
           
protected  Map attributes
           
protected  int glyphIndex
           
protected  Shape shape
           
protected  Vector substitutedGlyphs
           
protected  int theChar
           
protected  AffineTransform transformation
           
 
Fields inherited from interface de.inghuimische.uta.typeset.Glyph
NO_CHARACTER
 
Constructor Summary
SimpleGlyph()
           
 
Method Summary
 List getAnchors()
          Returns a list of all anchors.
 Map getAttributes()
          Returns a map of key value pairs, the attributes of this box.
 int getCharacter()
          Returns the character represented by this glyph, if there are more than one characters this method returns the first one.
 int getGlyphIndex()
          Returns the glyph index.
 Shape getShape()
          Returns the shape of this box.
 List getSubstitutedGlyphs()
          Returns a list of glyphs substituted by this one, or null if there are no substituted glyphs.
 AffineTransform getTransformation()
          Returns the transformation matrix associated with this box.
 boolean isSubstituting()
          Tells whether this glyph is substituting several others.
static void main(String[] args)
           
 void reset()
          Frees all allocated resources.
 void setAnchors(Vector anchors)
          Sets the anchors.
 void setAttributes(Map attributes)
          Sets the attributes.
 void setChar(int theChar)
          Sets the theChar.
 void setGlyphIndex(int i)
          Sets the index of this glyph.
 void setShape(Shape shape)
          Sets the shape.
 void setSubstitutedGlyphs(Vector substitutedGlyphs)
          Sets the substitutedGlyphs.
 void setTransformation(AffineTransform transformation)
          Sets the transformation.
 
Methods inherited from class de.inghuimische.uta.typeset.AbstractGlyph
getCharacters
 
Methods inherited from class de.inghuimische.uta.typeset.AbstractBox
getAnchorsByClass, getBoundingBox
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface de.inghuimische.uta.typeset.Box
getAnchorsByClass, getBoundingBox
 

Field Detail

glyphIndex

protected int glyphIndex

theChar

protected int theChar

substitutedGlyphs

protected Vector substitutedGlyphs

anchors

protected Vector anchors

shape

protected Shape shape

attributes

protected Map attributes

transformation

protected AffineTransform transformation
Constructor Detail

SimpleGlyph

public SimpleGlyph()
Method Detail

setAnchors

public void setAnchors(Vector anchors)
Sets the anchors.

Parameters:
anchors - The anchors to set.

setAttributes

public void setAttributes(Map attributes)
Sets the attributes.

Parameters:
attributes - The attributes to set.

setSubstitutedGlyphs

public void setSubstitutedGlyphs(Vector substitutedGlyphs)
Sets the substitutedGlyphs.

Parameters:
substitutedGlyphs - The substitutedGlyphs to set.

setChar

public void setChar(int theChar)
Sets the theChar.

Parameters:
theChar - The theChar to set.

setShape

public void setShape(Shape shape)
Sets the shape.

Parameters:
shape - The shape to set.

setTransformation

public void setTransformation(AffineTransform transformation)
Sets the transformation.

Parameters:
transformation - The transformation to set.

getGlyphIndex

public int getGlyphIndex()
Description copied from interface: Glyph
Returns the glyph index. This value may differ from font to font for the same character.

Returns:
The glyph index. This value may differ from font to font for the same character.

setGlyphIndex

public void setGlyphIndex(int i)
Description copied from interface: Glyph
Sets the index of this glyph. This is done by a Script. The value depends on the font used.

Parameters:
i - The index of the glyph.

getCharacter

public int getCharacter()
Description copied from interface: Glyph
Returns the character represented by this glyph, if there are more than one characters this method returns the first one. If no character is set thie method returns Glyph.NO_CHARACTER.

Returns:
The character represented by this glyph, if there are more than one characters this method returns the first one.

getSubstitutedGlyphs

public List getSubstitutedGlyphs()
Description copied from interface: Glyph
Returns a list of glyphs substituted by this one, or null if there are no substituted glyphs.

Returns:
A list of glyphs substituted by this one, or null if there are no substituted glyphs.

isSubstituting

public boolean isSubstituting()
Description copied from interface: Glyph
Tells whether this glyph is substituting several others.

Returns:
true if this glyph substitutes other one, false if it is a single glyph.

getAnchors

public List getAnchors()
Description copied from interface: Box
Returns a list of all anchors. A box has n anchors.

Returns:
A list of all anchors.

getShape

public Shape getShape()
Description copied from interface: Box
Returns the shape of this box.

In the case of a box this is simply a rectangle while other classes implementing this interface may have quite complex shapes.

Document processors may never need this method therefore implementations should care that the shape is returned on demand to save runtime/memory.

Returns:
The shape of this box.

getAttributes

public Map getAttributes()
Description copied from interface: Box
Returns a map of key value pairs, the attributes of this box.

Returns:
A map of key value pairs.

getTransformation

public AffineTransform getTransformation()
Description copied from interface: Box
Returns the transformation matrix associated with this box. This transformation is relative to the origin.

Returns:
The transformation matrix associated with this box.

reset

public void reset()
Description copied from class: AbstractBox
Frees all allocated resources. Useful when caching and reusing boxes.

Specified by:
reset in class AbstractBox

main

public static void main(String[] args)

Unified Typesetting API M1-20040817


An inghuimische.de project.
Copyright (C) 2004 Christian Ziesemer; See the Mozilla Public License for more details.