com.flagstone.transform.font
Class GlyphAlignment

java.lang.Object
  extended by com.flagstone.transform.font.GlyphAlignment
All Implemented Interfaces:
Copyable<GlyphAlignment>, SWFEncodeable

public final class GlyphAlignment
extends Object
implements SWFEncodeable, Copyable<GlyphAlignment>

GlyphAlignment holds the alignment zones for a font glyph.


Constructor Summary
GlyphAlignment(GlyphAlignment object)
          Creates and initialises a GlyphAlignment object using the values copied from another GlyphAlignment object.
GlyphAlignment(List<AlignmentZone> list, boolean xAlign, boolean yAlign)
          Creates a new GlyphAlignment with the alignment zones.
GlyphAlignment(SWFDecoder coder)
          Creates and initialises a GlyphAlignment object using values encoded in the Flash binary format.
 
Method Summary
 boolean alignmentX()
          Does the list of alignment zones contain a horizontal alignment.
 boolean alignmentY()
          Does the list of alignment zones contain a vertical alignment.
 GlyphAlignment copy()
          Creates a complete copy of this object.
 void encode(SWFEncoder coder, Context context)
          Encode an object to the Flash binary format.
 List<AlignmentZone> getAlignments()
          Get the list of alignment zones.
 int prepareToEncode(Context context)
          Prepare an object for encoding, returning the expected size of an object when it is encoded.
 void setAlignments(List<AlignmentZone> list)
          Set the list of alignment zones.
 void setAlignmentX(boolean hasAlign)
          Indicates that the list of alignment zones contain a horizontal alignment.
 void setAlignmentY(boolean hasAlign)
          Indicates that the list of alignment zones contain a vertical alignment.
 String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

GlyphAlignment

public GlyphAlignment(SWFDecoder coder)
               throws IOException
Creates and initialises a GlyphAlignment object using values encoded in the Flash binary format.

Parameters:
coder - an SWFDecoder object that contains the encoded Flash data.
Throws:
IOException - if an error occurs while decoding the data.

GlyphAlignment

public GlyphAlignment(List<AlignmentZone> list,
                      boolean xAlign,
                      boolean yAlign)
Creates a new GlyphAlignment with the alignment zones.

Parameters:
list - the list of alignment zones for the glyph.
xAlign - whether there is a horizontal alignment zone.
yAlign - whether there is a vertical alignment zone.

GlyphAlignment

public GlyphAlignment(GlyphAlignment object)
Creates and initialises a GlyphAlignment object using the values copied from another GlyphAlignment object.

Parameters:
object - a GlyphAlignment object from which the values will be copied.
Method Detail

alignmentX

public boolean alignmentX()
Does the list of alignment zones contain a horizontal alignment.

Returns:
true if the list contains the alignment for the width of a glyph.

setAlignmentX

public void setAlignmentX(boolean hasAlign)
Indicates that the list of alignment zones contain a horizontal alignment.

Parameters:
hasAlign - true if the list contains the alignment for the width of a glyph, false otherwise.

alignmentY

public boolean alignmentY()
Does the list of alignment zones contain a vertical alignment.

Returns:
true if the list contains the alignment for the height of a glyph.

setAlignmentY

public void setAlignmentY(boolean hasAlign)
Indicates that the list of alignment zones contain a vertical alignment.

Parameters:
hasAlign - true if the list contains the alignment for the height of a glyph, false otherwise.

getAlignments

public List<AlignmentZone> getAlignments()
Get the list of alignment zones.

Returns:
a list of AlignmentZones describing the alignment areas for a glyph.

setAlignments

public void setAlignments(List<AlignmentZone> list)
Set the list of alignment zones.

Parameters:
list - a list of AlignmentZones describing the alignment areas for a glyph.

copy

public GlyphAlignment copy()
Creates a complete copy of this object.

Specified by:
copy in interface Copyable<GlyphAlignment>
Returns:
a deep-copy of this object. New instances of mutable objects are copied and immutable instances are shared.

toString

public String toString()
Overrides:
toString in class Object

prepareToEncode

public int prepareToEncode(Context context)
Prepare an object for encoding, returning the expected size of an object when it is encoded. This method also used to initialise variables, such as offsets and flags that will be used when the object is encoded. Generally the method returns the size in bytes, however when called on objects that use bit fields such as shapes the methods will return the size in bits.

Specified by:
prepareToEncode in interface SWFEncodeable
Parameters:
context - an Context that allows information to be passed between objects to control how they are initialised for encoding.
Returns:
the size of the object when it is encoded.

encode

public void encode(SWFEncoder coder,
                   Context context)
            throws IOException
Encode an object to the Flash binary format.

Specified by:
encode in interface SWFEncodeable
Parameters:
coder - an SWFEncoder object.
context - an Context that allows information to be passed between objects to control how they are initialised for encoding.
Throws:
IOException - if an error occurs while encoding the object.


Copyright © 2002-2010 Flagstone Software Ltd.. All Rights Reserved.