|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcom.flagstone.transform.font.FontInfo
public final class FontInfo
FontInfo defines the name and face of a font and maps the codes for a given character set to the glyphs that are drawn to represent each character.
Three different encoding schemes are supported for the character codes. The ANSI character set is used for Latin languages, SJIS is used for Japanese language characters and Unicode is used for any character set. Since Flash 5 Unicode is the preferred encoding scheme.
The index of each entry in the codes list matches the index in the corresponding glyph in the shapes list of an DefineFont object, allowing a given character code to be mapped to a given glyph.
FontInfo also 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 DefineFont class are used to render the characters.
An important distinction between the host device to specify the font and using the glyphs in an DefineFont object is that the device font is not anti-aliased and the rendering is dependent on the host device. The glyphs in an DefineFont object are anti-aliased and are guaranteed to look identical on every device the text is displayed.
| Constructor Summary | |
|---|---|
FontInfo(FontInfo object)
Creates and initialises a FontInfo object using the values copied from another FontInfo object. |
|
FontInfo(int uid,
String fontName,
boolean isBold,
boolean isItalic)
Constructs a basic FontInfo object specifying only the name and style of the font. |
|
FontInfo(SWFDecoder coder)
Creates and initialises an FontInfo object using values encoded in the Flash binary format. |
|
| Method Summary | |
|---|---|
void |
addCode(int aCode)
Add a code to the list of codes. |
FontInfo |
copy()
Creates a complete copy of this object. |
void |
encode(SWFEncoder coder,
Context context)
Encode an object to the Flash binary format. |
List<Integer> |
getCodes()
Get the list of character codes. |
CharacterFormat |
getEncoding()
Get the encoding scheme used for characters rendered in the font, either ASCII, SJIS or UCS2. |
int |
getIdentifier()
Get the unique identifier of the font definition that this font information is for. |
String |
getName()
Get the name of the font family. |
boolean |
isBold()
Is the font weight bold. |
boolean |
isItalic()
Is the font style italics. |
boolean |
isSmall()
Does the font have a small point size. |
int |
prepareToEncode(Context context)
Prepare an object for encoding, returning the expected size of an object when it is encoded. |
void |
setBold(boolean aBool)
Sets the font is bold. |
void |
setCodes(List<Integer> list)
Sets the list of character codes. |
void |
setEncoding(CharacterFormat anEncoding)
Sets the font character encoding. |
void |
setIdentifier(int uid)
Sets the identifier of the font that this font information is for. |
void |
setItalic(boolean aBool)
Sets the font is italics. |
void |
setName(String aString)
Sets the name of the font. |
void |
setSmall(boolean aBool)
Sets the font is small. |
String |
toString()
|
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Constructor Detail |
|---|
public FontInfo(SWFDecoder coder)
throws IOException
coder - an SWFDecoder object that contains the encoded Flash data.
IOException - if an error occurs while decoding the data.
public FontInfo(int uid,
String fontName,
boolean isBold,
boolean isItalic)
uid - the unique identifier of the DefineFont that contains the
glyphs for the font.fontName - the name assigned to the font, identifying the font family.isBold - indicates whether the font weight is bold (true) or normal
(false).isItalic - indicates whether the font style is italic (true) or plain
(false).public FontInfo(FontInfo object)
object - a FontInfo object from which the values will be
copied.| Method Detail |
|---|
public int getIdentifier()
public String getName()
public CharacterFormat getEncoding()
public boolean isSmall()
public void setSmall(boolean aBool)
aBool - true if the font will be aligned on pixel boundaries.public boolean isItalic()
public boolean isBold()
public List<Integer> getCodes()
public void setIdentifier(int uid)
uid - the unique identifier of the DefineFont that contains the
glyphs for the font. Must be in the range 1..65535.public void setName(String aString)
aString - the name assigned to the font, identifying the font family.
Must not be null.public void setEncoding(CharacterFormat anEncoding)
anEncoding - the encoding used to identify characters, either ASCII, SJIS
or UNICODE.public void setItalic(boolean aBool)
aBool - a boolean flag indicating whether the font will be rendered in
italics.public void setBold(boolean aBool)
aBool - a boolean flag indicating whether the font will be rendered in
bold face.public void addCode(int aCode)
aCode - a code for a glyph. Must be in the range 0..65535.public void setCodes(List<Integer> list)
list - the list mapping glyphs to particular character codes. Must
not be null.public FontInfo copy()
copy in interface Copyable<MovieTag>public String toString()
toString in class Objectpublic int prepareToEncode(Context context)
prepareToEncode in interface SWFEncodeablecontext - an Context that allows information to be passed between
objects to control how they are initialised for encoding.
public void encode(SWFEncoder coder,
Context context)
throws IOException
encode in interface SWFEncodeablecoder - an SWFEncoder object.context - an Context that allows information to be passed between
objects to control how they are initialised for encoding.
IOException - if an error occurs while encoding the object.
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||