de.dante.extex.font
Class FontFactoryImpl

java.lang.Object
  extended byde.dante.extex.font.FontFactoryImpl
All Implemented Interfaces:
FontFactory, PropertyConfigurable

public class FontFactoryImpl
extends java.lang.Object
implements FontFactory, PropertyConfigurable

Factory to load a font.

Version:
$Revision: 1.36 $
Author:
Michael Niedermair, Gerd Neugebauer

Field Summary
 
Fields inherited from interface de.dante.extex.font.FontFactory
AFM_EXTENSION, EFM_EXTENSION, OTF_EXTENSION, TFM_EXTENSION, TTF_EXTENSION, VF_EXTENSION
 
Constructor Summary
FontFactoryImpl(Configuration config, ResourceFinder resourceFinder)
          Creates a new object.
 
Method Summary
 java.io.InputStream findResource(java.lang.String name, java.lang.String type)
           
 Font getInstance(FountKey key)
          Return a new instance.
 Font getInstance(TFMFont tfm, FountKey key)
          Return a new instance.
 Font getInstance(VFFont vf, FountKey key)
          Return a new instance.
 PSFontsMapReader getPsfm()
          Returns the psfontmapreader.
 AfmFont readAFMFont(java.lang.String name)
          Read an afm font.
 EfmReader readEFMFont(java.lang.String name)
          Read a tfm font.
 TFMFont readTFMFont(java.lang.String name)
          Read a tfm font.
 VFFont readVFFont(java.lang.String name)
          Read a vf font.
 void setProperties(java.util.Properties properties)
          Setter for the properties.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

FontFactoryImpl

public FontFactoryImpl(Configuration config,
                       ResourceFinder resourceFinder)
                throws ConfigurationException
Creates a new object.

Parameters:
config - the configuration object
resourceFinder - the file finder
Throws:
ConfigurationException - from the resource finder
Method Detail

findResource

public java.io.InputStream findResource(java.lang.String name,
                                        java.lang.String type)
                                 throws ConfigurationException
Throws:
ConfigurationException
See Also:
ResourceFinder.findResource( java.lang.String, java.lang.String)

getInstance

public Font getInstance(FountKey key)
                 throws ConfigurationException,
                        FontException
Return a new instance. If the name is empty or null, then the NullFont are returned.

Specified by:
getInstance in interface FontFactory
Parameters:
key - the fount key
Returns:
the new font instance.
Throws:
ConfigurationException - from the resource finder.
FontException - if a font-error occurred.

getInstance

public Font getInstance(TFMFont tfm,
                        FountKey key)
                 throws ConfigurationException,
                        FontException
Return a new instance. If the name is empty or null, then the NullFont are returned.

Specified by:
getInstance in interface FontFactory
Parameters:
tfm - the tfm font
key - the fount key
Returns:
Returns the new font instance.
Throws:
ConfigurationException - from the resource finder.
FontException - if a font error occurred.

getInstance

public Font getInstance(VFFont vf,
                        FountKey key)
                 throws ConfigurationException,
                        FontException
Return a new instance. If the name is empty or null, then the NullFont are returned.

Specified by:
getInstance in interface FontFactory
Parameters:
vf - the vf font
key - the fount key
Returns:
Returns the new font instance.
Throws:
ConfigurationException - from the resource finder.
FontException - if a font-error occurred.

getPsfm

public PSFontsMapReader getPsfm()
                         throws FontException,
                                ConfigurationException
Returns the psfontmapreader.

Specified by:
getPsfm in interface FontFactory
Returns:
Returns the psfm.
Throws:
FontException - if a font-error occurs.
ConfigurationException - from the config-system.

readAFMFont

public AfmFont readAFMFont(java.lang.String name)
                    throws ConfigurationException,
                           FontException
Read an afm font.

Specified by:
readAFMFont in interface FontFactory
Parameters:
name - the name of the afm file
Returns:
the afm font or null, if not found
Throws:
ConfigurationException - from the resource finder
FontException - in case of a font error

readEFMFont

public EfmReader readEFMFont(java.lang.String name)
                      throws ConfigurationException,
                             FontException
Read a tfm font.

Specified by:
readEFMFont in interface FontFactory
Parameters:
name - the name of the tfm file
Returns:
the tfm font or null, if not found
Throws:
ConfigurationException - from the resource finder
FontException - in case of a font error

readTFMFont

public TFMFont readTFMFont(java.lang.String name)
                    throws ConfigurationException,
                           FontException
Read a tfm font.

Specified by:
readTFMFont in interface FontFactory
Parameters:
name - the name of the tfm file
Returns:
the tfm font or null, if not found
Throws:
ConfigurationException - from the resource finder
FontException - in case of a font error

readVFFont

public VFFont readVFFont(java.lang.String name)
                  throws ConfigurationException,
                         FontException
Read a vf font.

Specified by:
readVFFont in interface FontFactory
Parameters:
name - the name of the vf-file
Returns:
the vf font or null, if not found
Throws:
ConfigurationException - from the resource finder
FontException - in case of a font error

setProperties

public void setProperties(java.util.Properties properties)
Description copied from interface: PropertyConfigurable
Setter for the properties.

Specified by:
setProperties in interface PropertyConfigurable
Parameters:
properties - the properties to use for configuration
See Also:
PropertyConfigurable.setProperties(java.util.Properties)