FontFactory

Overview | Package | Class | Use | Tree | Deprecated | Index | Help

PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.dvb.ui
Class FontFactory

    java.lang.Object
      org.dvb.ui.FontFactory

    public class FontFactory

extends Object

Provides a mechanism for applications to instantiate fonts that are not built into the system. The two constructors of this class allow fonts to be downloaded either through the font index file of the application or directly from a font file in the format(s) specified in the main body of the present document.

Constructor Summary
`FontFactory()` Constructs a FontFactory for the font index file bound to this application in the application signalling.
`FontFactory(URL u)` Constructs a FontFactory for the font file found at the given location.

Method Summary
`Font` | `createFont(String name, int style, int size)` Creates a font object from the font source associated with this FontFactory.

Methods inherited from class java.lang.Object
`equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Constructor Detail

### FontFactory

    public FontFactory()
                throws FontFormatException,
                       IOException

  Constructs a FontFactory for the font index file bound to this application in the application signalling. The call to the constructor is synchronous and shall block until the font index file has been retrieved or an an exception is thrown.

  Throws:
    `FontFormatException` - if there is an error in the font index file bound with the application.
    `IOException` - if there is no font index file bound with the application, or if there is an error attempting to access the data in that file.

### FontFactory

    public FontFactory(URL u)
                throws IOException,
                       FontFormatException

  Constructs a FontFactory for the font file found at the given location. The call to the constructor is synchronous and shall block until the font file has been retrieved or an exception is thrown.

  Parameters:
    `u` - The location of the font file
  Throws:
    `IOException` - if there is an error attempting to access the data referenced by the URL
    `IllegalArgumentException` - if the URL is not both valid and supported
    `SecurityException` - if access to the specified URL is denied by security policy
    `FontFormatException` - if the file at that URL is not a valid font file as specified in the main body of the present document

Method Detail

### createFont

    public Font createFont(String name,
                           int style,
                           int size)
                    throws FontNotAvailableException,
                           FontFormatException,
                           IOException

  Creates a font object from the font source associated with this FontFactory. This font will remain valid even if the FontFactory is no longer reachable from application code. The name returned by Font.getName() might not be the same as the name supplied, for example, it might have a string prepended to it that identifies the source FontFactory in a platform-dependant manner. For FontFactory instances bound to the font index file of an application, the call to the method is synchronous and shall block until either an exception is thrown or any required network access has completed.

  The value of the style argument must be as defined in java.awt.Font. Valid values are the following:

  - `java.awt.Font.PLAIN`
  - `java.awt.Font.BOLD`
  - `java.awt.Font.ITALIC`
  - `java.awt.Font.BOLD + java.awt.Font.ITALIC`

  Parameters:
    `name` - the font name
    `style` - the constant style used, such as java.awt.Font.PLAIN.
    `size` - the point size of the font
  Throws:
    `FontNotAvailableException` - if a font with given parameters cannot be located or created.
    `IOException` - if there is an error retrieving a font from the network. Thrown only for font factory instances bound to the font index file of an application.
    `IllegalArgumentException` - if the style parameter is not in the set of valid values, or if the size parameter is zero or negative.
    `FontFormatException` - if the font file is not a valid font file as specified in the main body of the present document. Thrown only for font factory instances bound to the font index file of an application.

Overview | Package | Class | Use | Tree | Deprecated | Index | Help

PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD