com.flagstone.transform.font
Class DefineFont4

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

public final class DefineFont4
extends Object
implements DefineTag

DefineFont4 is used to pass OpenType font data directly to the text rendering engine added in Flash Player 10.


Constructor Summary
DefineFont4(DefineFont4 object)
          Creates and initialises a DefineFont4 object using the values copied from another DefineFont3 object.
DefineFont4(int uid, String fontName, boolean isItalic, boolean isBold, byte[] font)
          Creates a new DefineFont4 with the specified identifier, font name and style and OpenType font data.
DefineFont4(SWFDecoder coder)
          Creates and initialises a DefineFont4 object using values encoded in the Flash binary format.
 
Method Summary
 DefineFont4 copy()
          Creates a complete copy of this object.
 void encode(SWFEncoder coder, Context context)
          Encode an object to the Flash binary format.
 byte[] getData()
          Get the OpenType font definition data.
 int getIdentifier()
          Get the unique identifier assigned to this object.
 String getName()
          Returns the name of the font family.
 boolean isBold()
          Is the font bold.
 boolean isItalic()
          Is the font italicised.
 int prepareToEncode(Context context)
          Prepare an object for encoding, returning the expected size of an object when it is encoded.
 void setBold(boolean aBool)
          Set the font is bold.
 void setData(byte[] bytes)
          Set the OpenType font definition data.
 void setIdentifier(int uid)
          Sets the unique identifier for an object within a given Movie.
 void setItalic(boolean aBool)
          Set the font is italicised.
 void setName(String aString)
          Set the name of the font.
 String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

DefineFont4

public DefineFont4(SWFDecoder coder)
            throws IOException
Creates and initialises a DefineFont4 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.

DefineFont4

public DefineFont4(int uid,
                   String fontName,
                   boolean isItalic,
                   boolean isBold,
                   byte[] font)
Creates a new DefineFont4 with the specified identifier, font name and style and OpenType font data.

Parameters:
uid - the unique identifier for the font.
fontName - the name of the font.
isItalic - does the font use italics
isBold - is the font bold.
font - the OpenType font data.

DefineFont4

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

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

getIdentifier

public int getIdentifier()
Get the unique identifier assigned to this object.

Specified by:
getIdentifier in interface DefineTag
Returns:
the unique identifier used by the Flash Player to reference this definition.

setIdentifier

public void setIdentifier(int uid)
Sets the unique identifier for an object within a given Movie.

Specified by:
setIdentifier in interface DefineTag
Parameters:
uid - a unique identifier for the object. Must be in the range 1..65535.

isItalic

public boolean isItalic()
Is the font italicised.

Returns:
a boolean indicating whether the font is rendered in italics.

isBold

public boolean isBold()
Is the font bold.

Returns:
a boolean indicating whether the font is rendered in a bold face.

getName

public String getName()
Returns the name of the font family.

Returns:
the name of the font.

setItalic

public void setItalic(boolean aBool)
Set the font is italicised.

Parameters:
aBool - a boolean flag indicating whether the font will be rendered in italics

setBold

public void setBold(boolean aBool)
Set the font is bold.

Parameters:
aBool - a boolean flag indicating whether the font will be rendered in bold face.

setName

public void setName(String aString)
Set the name of the font.

Parameters:
aString - the name assigned to the font, identifying the font family. Must not be null.

getData

public byte[] getData()
Get the OpenType font definition data.

Returns:
a copy of the binary data containing the definition of the font.

setData

public void setData(byte[] bytes)
Set the OpenType font definition data.

Parameters:
bytes - the binary data containing the definition of the font.

copy

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

Specified by:
copy in interface Copyable<MovieTag>
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.