com.flagstone.transform
Class FSFontInfo2

java.lang.Object
  extended by com.flagstone.transform.FSTransformObject
      extended by com.flagstone.transform.FSMovieObject
          extended by com.flagstone.transform.FSFontInfo2
All Implemented Interfaces:
java.lang.Cloneable

public class FSFontInfo2
extends FSMovieObject

FSFontInfo2 describes the mapping of codes for a given character set to the glyphs that are drawn to represent the character.

It extends the functionality provided by FSFontInfo by adding a language attribute which is support to support line-breaking when displaying text in different spoken languages. Support for small fonts was added in Flash 7.

The class allows the font associated with a Flash file to be mapped to a font installed on the device where the Flash Player displaying the file is hosted. The use of a font from a device is not automatic but is determined by the HTML tag option deviceFont which is passed to the Flash Player when it is first started. If a device does not support a given font then the glyphs in the FSDefineFont class are used to render the characters.

An important distinction between the host device to specify the font and using the glyphs in an FSDefineFont object is that the device is not anti-aliased and the rendering is dependent on the host device. The glyphs in an FSDefineFont object are anti-aliased and are guaranteed to look identical on every device the text is displayed.

Attributes
type Identifies the data structure when it is encoded. Read-only.
identifier The unique identifier for an FSDefineFont object that contains all the glyphs for the font.
name The name of the font.
small Indicates the font is small enough to align to pixel boundaries.
encoding Specifies whether the character codes areTransform.ANSI,Transform.SJIS, Unicode.
bold Whether the font is bold.
italic Whether the font is italicised.
language A code identifying the spoken language for a font, either Latin, Japanese, Korean, SimplifiedChinese or TraditionalChinese. The language code is used to assist in determining the position of line breaks in text displayed using the font.
codes An array mapping a glyph index to a particular character code in the font.

The index of each entry in the codes array matches the index in the corresponding glyph in the shapes array of an FSDefineFont object, allowing a given character code to be mapped to a given glyph.

History

The FSFontInfo2 class supports the DefineFontInfo2 data structure introduced in Flash 6. Support for small fonts was added in Flash 7.


Field Summary
 
Fields inherited from class com.flagstone.transform.FSMovieObject
ButtonColorTransform, ButtonSound, DefineBitsPtr, DefineButton, DefineButton2, DefineFont, DefineFont2, DefineImage, DefineImage2, DefineJPEGImage, DefineJPEGImage2, DefineJPEGImage3, DefineMorphShape, DefineMovieClip, DefineShape, DefineShape2, DefineShape3, DefineSound, DefineText, DefineText2, DefineTextField, DefineVideo, DoAction, EnableDebugger, EnableDebugger2, Export, extendLength, FontInfo, FontInfo2, FrameLabel, Free, Import, Initialize, JPEGTables, length, LimitScript, PathsArePostscript, PlaceObject, PlaceObject2, Protect, QuicktimeMovie, RemoveObject, RemoveObject2, SerialNumber, SetBackgroundColor, ShowFrame, SoundStreamBlock, SoundStreamHead, SoundStreamHead2, StartSound, TabOrder, type, VideoFrame
 
Constructor Summary
FSFontInfo2(FSCoder coder)
          Construct an FSFontInfo2 object, initialising it with values decoded from an encoded object.
FSFontInfo2(FSFontInfo2 obj)
          Constructs an FSFontInfo2 object by copying values from an existing object.
FSFontInfo2(int anIdentifier, java.lang.String aName)
          Constructs a basic FSFontInfo2 object specifying only the name of the font.
 
Method Summary
 void appendDescription(java.lang.StringBuffer buffer, int depth)
          AppendDescription is used to present a string description of the object including all nested objects up to a specified depth.
 java.lang.Object clone()
          Creates a deep copy of the entire object.
 void decode(FSCoder coder)
           
 void encode(FSCoder coder)
           
 boolean equals(java.lang.Object anObject)
          Returns true if anObject is equal to this one.
 java.util.ArrayList getCodes()
          Gets the array of character codes.
 int getEncoding()
          Gets the encoding scheme used for characters rendered in the font, either FSText.ASCII, FSText.SJIS or FSText.Unicode.
 int getIdentifier()
          Gets the identifier of the font that this font information is for.
 int getLanguage()
          Gets the language code identifying the type of spoken language for the font, either FSText.Japanese, FSText.Korean, FSText.Latin, FSText.SimplifiedChinese or FSText.TraditionalChinese.
 java.lang.String getName()
          Gets the name of the font family.
 boolean isBold()
          Is the font bold.
 boolean isItalic()
          Is the font italics.
 boolean isSmall()
          Does the font have a small point size.
 int length(FSCoder coder)
           
 void setBold(boolean aBool)
          Sets the font is bold.
 void setCodes(java.util.ArrayList anArray)
          Sets the array of character codes.
 void setEncoding(int anEncoding)
          Sets the font character encoding.
 void setIdentifier(int anIdentifier)
          Sets the identifier of the font that this font information is for.
 void setItalic(boolean aBool)
          Sets the font is italics.
 void setLanguage(int code)
          Sets the language code used to determine the position of line-breaks in text rendered using the font.
 void setName(java.lang.String aString)
          Sets the name of the font.
 void setSmall(boolean aBool)
          Sets the font is small.
 
Methods inherited from class com.flagstone.transform.FSMovieObject
getType
 
Methods inherited from class com.flagstone.transform.FSTransformObject
name, toString
 
Methods inherited from class java.lang.Object
finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

FSFontInfo2

public FSFontInfo2(FSCoder coder)
Construct an FSFontInfo2 object, initialising it with values decoded from an encoded object.

Parameters:
coder - an FSCoder containing the binary data.

FSFontInfo2

public FSFontInfo2(int anIdentifier,
                   java.lang.String aName)
Constructs a basic FSFontInfo2 object specifying only the name of the font.

Parameters:
anIdentifier - the unique identifier of the FSDefineFont that contains the glyphs for the font.
aName - the name assigned to the font, identifying the font family.

FSFontInfo2

public FSFontInfo2(FSFontInfo2 obj)
Constructs an FSFontInfo2 object by copying values from an existing object.

Parameters:
obj - an FSFontInfo2 object.
Method Detail

getIdentifier

public int getIdentifier()
Gets the identifier of the font that this font information is for.

Returns:
the identifier of the FSDefineFont object that contains the glyphs for the font.

getName

public java.lang.String getName()
Gets the name of the font family.

Returns:
the name of the font.

getEncoding

public int getEncoding()
Gets the encoding scheme used for characters rendered in the font, either FSText.ASCII, FSText.SJIS or FSText.Unicode.

Returns:
the font character encoding.

isSmall

public boolean isSmall()
Does the font have a small point size. This is used only with a Unicode font encoding.

Returns:
a boolean indicating whether the font will be aligned on pixel boundaries.

setSmall

public void setSmall(boolean aBool)
Sets the font is small. Used only with Unicode fonts.

Parameters:
aBool - a boolean flag indicating the font will be aligned on pixel boundaries.

isItalic

public boolean isItalic()
Is the font italics.

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.

getLanguage

public int getLanguage()
Gets the language code identifying the type of spoken language for the font, either FSText.Japanese, FSText.Korean, FSText.Latin, FSText.SimplifiedChinese or FSText.TraditionalChinese.

Returns:
the language code used to determine how line-breaks are inserted into text rendered using the font.

getCodes

public java.util.ArrayList getCodes()
Gets the array of character codes.

Returns:
the array of character codes.

setIdentifier

public void setIdentifier(int anIdentifier)
Sets the identifier of the font that this font information is for.

Parameters:
anIdentifier - the unique identifier of the FSDefineFont that contains the glyphs for the font.

setName

public void setName(java.lang.String aString)
Sets the name of the font.

Parameters:
aString - the name assigned to the font, identifying the font family.

setEncoding

public void setEncoding(int anEncoding)
Sets the font character encoding.

Parameters:
anEncoding - the encoding used to identify characters, either FSText.ASCII, FSText.SJIS or FSText.Unicode.

setItalic

public void setItalic(boolean aBool)
Sets the font is italics.

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

setBold

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

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

setLanguage

public void setLanguage(int code)
Sets the language code used to determine the position of line-breaks in text rendered using the font. The language attribute is ignored if the object is encoded in a Flash 5 movie.

Parameters:
code - the code identifying the spoken language either Latin, Japanese, Korean, SimplifiedChinese or TraditionalChinese.

setCodes

public void setCodes(java.util.ArrayList anArray)
Sets the array of character codes.

Parameters:
anArray - the array mapping glyphs to particular character codes. The ordinal position of a character code in the array identifies the index of the corresponding glyph in the FSDefineFont object.

clone

public java.lang.Object clone()
Description copied from class: FSTransformObject
Creates a deep copy of the entire object.

Overrides:
clone in class FSTransformObject
Returns:
a copy of the object.

equals

public boolean equals(java.lang.Object anObject)
Description copied from class: FSMovieObject
Returns true if anObject is equal to this one. Objects are considered equal if they would generate identical binary data when they are encoded to a Flash file.

Overrides:
equals in class FSMovieObject
Returns:
true if this object would be identical to anObject when encoded.

appendDescription

public void appendDescription(java.lang.StringBuffer buffer,
                              int depth)
Description copied from class: FSTransformObject
AppendDescription is used to present a string description of the object including all nested objects up to a specified depth. This method provide a more controlled way of creating a string representation of an object since large objects such as font or shape definitions can contain dozens of nested objects. The representation of the object is appended to the StringBuffer, showing the name of the class and values of the attributes it contains. If the object contains any attributes that are objects then the object graph will be traversed up to the specified depth. If objects are nested at a level less than specified depth then the full string representation of the object is displayed. For objects at the specified depth only the name of the class is displayed. Any objects below this depth are not displayed.

Overrides:
appendDescription in class FSMovieObject
Parameters:
buffer - a StringBuffer to which the description of each object is appended.
depth - the maximum level of nesting up to which objects will be displayed.

length

public int length(FSCoder coder)
Overrides:
length in class FSMovieObject

encode

public void encode(FSCoder coder)
Overrides:
encode in class FSMovieObject

decode

public void decode(FSCoder coder)
Overrides:
decode in class FSMovieObject