com.flagstone.transform.util.font
Class SWFFontDecoder

java.lang.Object
  extended by com.flagstone.transform.util.font.SWFFontDecoder
All Implemented Interfaces:
FontDecoder, FontProvider

public final class SWFFontDecoder
extends Object
implements FontProvider, FontDecoder

SWFFontDecoder decodes one or more existing font definitions from a Flash file. The definitions may be either DefineFont/FontInfo pairs, DefineFont2 or DefineFont2. Files containing DefineFont4 definitions are not supported since they contain font encoded using the OpenType format.


Constructor Summary
SWFFontDecoder()
           
 
Method Summary
 void decode(DefineFont definition)
          Initialise this object with the information from a flash font definition.
 void decode(DefineFont2 object)
          Initialise this object with the information from a flash font definition.
 void decode(DefineFont3 object)
          Initialise this object with the information from a flash font definition.
 void decode(FontInfo info)
          Initialise this object with the information from a flash font definition.
 void decode(FontInfo2 info)
          Initialise this object with the information from a flash font definition.
 List<Font> getFonts()
          Get the list of fonts decoded.
 FontDecoder newDecoder()
          The method implemented by all FontDecoders in order to be registered with the FontRegistry and used by the FontFactory to decode fonts.
 void read(File file)
          Read a font from a file.
 void read(URL url)
          Read a font from a file referenced by a URL.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SWFFontDecoder

public SWFFontDecoder()
Method Detail

newDecoder

public FontDecoder newDecoder()
The method implemented by all FontDecoders in order to be registered with the FontRegistry and used by the FontFactory to decode fonts.

Specified by:
newDecoder in interface FontProvider
Returns:
an object that implements the FontDecoder interface.

read

public void read(File file)
          throws IOException,
                 DataFormatException
Read a font from a file.

Specified by:
read in interface FontDecoder
Parameters:
file - the path to the file.
Throws:
IOException - if there is an error reading the font data.
DataFormatException - if the file contains an unsupported format.

read

public void read(URL url)
          throws IOException,
                 DataFormatException
Read a font from a file referenced by a URL.

Specified by:
read in interface FontDecoder
Parameters:
url - the reference to the file.
Throws:
IOException - if there is an error reading the font data.
DataFormatException - if the file contains an unsupported format.

getFonts

public List<Font> getFonts()
Get the list of fonts decoded.

Specified by:
getFonts in interface FontDecoder
Returns:
a list of fonts.

decode

public void decode(DefineFont definition)
Initialise this object with the information from a flash font definition.

Parameters:
definition - a DefineFont object which contains the definition of the glyphs.

decode

public void decode(FontInfo info)
Initialise this object with the information from a flash font definition.

Parameters:
info - a FontInfo object that contains information on the font name, weight, style and character codes.

decode

public void decode(FontInfo2 info)
Initialise this object with the information from a flash font definition.

Parameters:
info - a FontInfo2 object that contains information on the font name, weight, style and character codes.

decode

public void decode(DefineFont2 object)
Initialise this object with the information from a flash font definition.

Parameters:
object - a DefineFont2 object that contains information on the font name, weight, style and character codes as well as the glyph definitions.

decode

public void decode(DefineFont3 object)
Initialise this object with the information from a flash font definition.

Parameters:
object - a DefineFont3 object that contains information on the font name, weight, style and character codes as well as the glyph definitions.


Copyright © 2002-2010 Flagstone Software Ltd.. All Rights Reserved.