|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.flagstone.transform.FSTransformObject
com.flagstone.transform.FSMovieObject
com.flagstone.transform.FSDefineObject
com.flagstone.transform.FSDefineFont2
public class FSDefineFont2
FSDefineFont2 defines the shapes and layout of the glyphs used in a font.
It extends the functionality provided by the FSDefineFont class by:
The FSDefineFont2 class combines the attributes of the FSFontInfo and FSDefineFont classes:
Attributes | |
---|---|
type | Identifies the data structure when it is encoded. The type attribute is read-only and may be used when iterating through the objects in an FSMovie object to identify the object class without using run-time type checking. |
identifier | The unique identifier for this object. |
encoding | Specifies whether the font codes are ANSI, SJIS or Unicode. |
language | Identifies the spoken language for the font, either FSText.Japanese, FSText.Korean, FSText.Latin, FSText.SimplifiedChinese, FSText.TraditionalChinese. This attribute is used when displaying text fields and assists in determining language-appropriate line breaks. |
italic | Whether the font is italicised. |
bold | Whether the font is bold. |
small | Small point size fonts will be drawn aligned to pixel boundaries to improve rendering. |
name | The name of the font. |
shapes | An array of FSShape objects that define the outline for each glyph. |
codes | An array mapping a glyph index to a particular character code in the font. |
Additional layout information for the glyphs in the font can also be specified through the following set of attributes:
ascent | The maximum ascent for the font in twips. |
descent | The maximum descent for the font in twips. |
leading | The leading for the font. |
advances | An array of integers that define the advance for each glyph in the font. |
bounds | An array of FSBounds object that define the bounding rectangle for each glyph in the font. |
kernings | An array of FSKerning objects that define adjustment to the advance for particular pairs of glyphs in the font. |
The default values for the ascent, descent and leading attributes is zero and the arrays containing the advances, bounds and kernings are empty. If the attributes all set to their default values then the layout information will not be encoded. All the values must be set and the arrays must contain the same number of entries as there are glyphs before the layout information will be encoded.
The FSDefineFont2 class represents the DefineFont2 structure from the Macromedia Flash (SWF) File Format Specification. It was introduced in Flash 2. Support for spoken languages was added in Flash 6. Support for small point size fonts was added in Flash 7.
Field Summary |
---|
Fields inherited from class com.flagstone.transform.FSDefineObject |
---|
identifier |
Constructor Summary | |
---|---|
FSDefineFont2(FSCoder coder)
Construct an FSDefineFont2 object, initalizing it with values decoded from an encoded object. |
|
FSDefineFont2(FSDefineFont2 obj)
Constructs an FSDefineFont2 object by copying values from an existing object. |
|
FSDefineFont2(int anIdentifier,
java.lang.String name)
Constructs an FSDefineFont2 object specifying only the name of the font. |
Method Summary | |
---|---|
void |
add(FSBounds anObject)
Add a bounds object to the array of bounds for each glyph. |
void |
add(FSKerning anObject)
Add a kerning object to the array of kernings for pairs of glyphs. |
void |
add(FSShape anObject)
Add a shape to the array of shapes. |
void |
addAdvance(int anAdvance)
Add an advance to the array of advances. |
void |
addCode(int aCode)
Add a code to the array of codes. |
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 |
getAdvances()
Gets the array of advances defined for each glyph in the font. |
int |
getAscent()
Gets the ascent for the font in twips. |
java.util.ArrayList |
getBounds()
Gets the array of bounding rectangles defined for each glyph in the font. |
java.util.ArrayList |
getCodes()
Gets the array of codes used to identify each glyph in the font. |
int |
getDescent()
Gets the descent for the font in twips. |
int |
getEncoding()
Gets the encoding used for the font codes, either FSText.ASCII, FSText.SJIS or FSText.Unicode. |
java.util.ArrayList |
getKernings()
Gets the array of kerning records that define the spacing between glyph pairs. |
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. |
int |
getLeading()
Gets the leading for the font in twips. |
java.lang.String |
getName()
Gets the name of the font family. |
java.util.ArrayList |
getShapes()
Gets the array of shapes used to define the outlines of each font glyph. |
boolean |
isBold()
Is the font bold. |
boolean |
isItalic()
Is the font italicised. |
boolean |
isSmall()
Does the font have a small point size. |
int |
length(FSCoder coder)
|
void |
setAdvances(java.util.ArrayList anArray)
Sets the array of advances for each glyph in the font. |
void |
setAscent(int aNumber)
Sets the ascent for the font in twips. |
void |
setBold(boolean aBool)
Set the font is bold. |
void |
setBounds(java.util.ArrayList anArray)
Sets the array of bounding rectangles for each glyph in the font. |
void |
setCodes(java.util.ArrayList anArray)
Sets the codes used to identify each glyph in the font. |
void |
setDescent(int aNumber)
Sets the descent for the font in twips. |
void |
setEncoding(int aType)
Sets the encoding for the font character codes. |
void |
setItalic(boolean aBool)
Set the font is italicised. |
void |
setKernings(java.util.ArrayList anArray)
Sets the array of kerning records for pairs of glyphs in the font. |
void |
setLanguage(int code)
Sets the language code used to determine the position of line-breaks in text rendered using the font. |
void |
setLeading(int aNumber)
Sets the leading for the font in twips. |
void |
setName(java.lang.String aString)
Set the name of the font. |
void |
setShapes(java.util.ArrayList anArray)
Set the array of shape records that define the outlines of the characters used from the font. |
void |
setSmall(boolean aBool)
Sets the font is small. |
Methods inherited from class com.flagstone.transform.FSDefineObject |
---|
getIdentifier, setIdentifier |
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 |
---|
public FSDefineFont2(FSCoder coder)
coder
- an FSCoder containing the binary data.public FSDefineFont2(int anIdentifier, java.lang.String name)
anIdentifier
- the unique identifier for this object.name
- the name of the font.public FSDefineFont2(FSDefineFont2 obj)
obj
- an FSDefineFont2 object.Method Detail |
---|
public void add(FSShape anObject)
anObject
- a shape.public void addCode(int aCode)
aCode
- a code for a glyph.public void addAdvance(int anAdvance)
anAdvance
- an advance for a glyph.public void add(FSBounds anObject)
anObject
- an FSBounds.public void add(FSKerning anObject)
anObject
- an FSKerning.public int getEncoding()
public boolean isSmall()
public void setSmall(boolean aBool)
aBool
- a boolean flag indicating the font will be aligned on pixel
boundaries.public boolean isItalic()
public boolean isBold()
public int getLanguage()
public void setLanguage(int code)
code
- the code identifying the spoken language either
FSText.Japanese, FSText.Korean, FSText.Latin,
FSText.SimplifiedChinese or FSText.TraditionalChinese.public java.lang.String getName()
public java.util.ArrayList getShapes()
public java.util.ArrayList getCodes()
public int getAscent()
public int getDescent()
public int getLeading()
public java.util.ArrayList getAdvances()
public java.util.ArrayList getBounds()
public java.util.ArrayList getKernings()
public void setEncoding(int aType)
aType
- the encoding scheme used to denote characters, either
FSText.ASCII, FSText.SJIS or FSText.Unicode.public void setItalic(boolean aBool)
aBool
- a boolean flag indicating whether the font will be rendered in
italicspublic void setBold(boolean aBool)
aBool
- a boolean flag indicating whether the font will be rendered in
bold face.public void setName(java.lang.String aString)
aString
- the name assigned to the font, identifying the font family.public void setShapes(java.util.ArrayList anArray)
anArray
- an array of FSShape objects that define the glyphs for the
font.public void setCodes(java.util.ArrayList anArray)
anArray
- sets the code table that maps a particular glyph to a
character code.public void setAscent(int aNumber)
aNumber
- the ascent for the font.public void setDescent(int aNumber)
aNumber
- the descent for the font.public void setLeading(int aNumber)
aNumber
- the descent for the font.public void setAdvances(java.util.ArrayList anArray)
anArray
- of Integer objects that define the spacing between glyphs.public void setBounds(java.util.ArrayList anArray)
anArray
- an array of FSBounds objects that define the bounding
rectangles that enclose each glyph in the font.public void setKernings(java.util.ArrayList anArray)
anArray
- an array of FSKerning objects that define an adjustment
applied to the spacing between pairs of glyphs.public java.lang.Object clone()
FSTransformObject
clone
in class FSTransformObject
public boolean equals(java.lang.Object anObject)
FSMovieObject
equals
in class FSMovieObject
public void appendDescription(java.lang.StringBuffer buffer, int depth)
FSTransformObject
appendDescription
in class FSDefineObject
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.public int length(FSCoder coder)
length
in class FSDefineObject
public void encode(FSCoder coder)
encode
in class FSDefineObject
public void decode(FSCoder coder)
decode
in class FSDefineObject
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |