Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## com.flagstone.transform
Class FSFontInfo

    java.lang.Object
      com.flagstone.transform.FSTransformObject
          com.flagstone.transform.FSMovieObject
              com.flagstone.transform.FSFontInfo

All Implemented Interfaces:
  java.lang.Cloneable

    public class FSFontInfo

extends FSMovieObject

FSFontInfo 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.

Attributes
type | Identifies the data structure when it is encoded. Read-only.
identifier | The unique identifier, in the range 1..65535, for the FSDefineFont object that contains the glyphs for the font.
name | The name of the font.
encoding | Specifies whether the codes for the character set are represented using ANSI (ASCII), SJIS or Unicode.
bold | Indicates the font is small enough to align to pixel boundaries.
bold | Whether the font is bold.
italic | Whether the font is rendered in italics.
isSmall | Indicates the font is small enough to align to pixel boundaries.
codes | An array mapping a glyph index to a particular character code in the font.

The ANSI character set is used for Latin languages, SJIS is used for Japanese language characters and Unicode is used for any character set. The encoding attributes uses the constants FSText.ANSI, FSText.SJIS or FSText.Unicode for each character set type.

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.

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.

# History

The FSFontInfo class represents the DefineFontInfo data structure from the Flash specification. It was introduced in Flash 1. 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
`FSFontInfo(FSCoder coder)` Construct an FSFontInfo object, initialising it with values decoded from an encoded object.
`FSFontInfo(FSFontInfo obj)` Constructs an FSFontInfo object by copying values from an existing object.
`FSFontInfo(int anIdentifier, java.lang.String aName)` Constructs a basic FSFontInfo 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.
`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` | `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

### FSFontInfo

    public FSFontInfo(FSCoder coder)

  Construct an FSFontInfo object, initialising it with values decoded from an encoded object.

  Parameters:
    `coder` - an FSCoder containing the binary data.

### FSFontInfo

    public FSFontInfo(int anIdentifier,
                      java.lang.String aName)

  Constructs a basic FSFontInfo 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.

### FSFontInfo

    public FSFontInfo(FSFontInfo obj)

  Constructs an FSFontInfo object by copying values from an existing object.

  Parameters:
    `obj` - an FSFontInfo 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.

### 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.

### setCodes

    public void setCodes(java.util.ArrayList anArray)

  Sets the array of character codes. The index position of a character code in the array identifies the index of the corresponding glyph in the FSDefineFont object.

  Parameters:
    `anArray` - the array mapping glyphs to particular character codes.

### 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`

Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD