Class FontFactory

java.lang.Object
com.adobe.fontengine.font.type1.FontFactory

public final class FontFactory extends Object
Creates font objects for legacy type1 fonts.

Synchronization

This class represents a namespace and does not contain instance data or mutable static data. It is therefore threadsafe.
  • Constructor Details

    • FontFactory

      public FontFactory()
  • Method Details

    • getNumBytesNeededToIdentify

      public static int getNumBytesNeededToIdentify()
      Returns the number of initial bytes necessary to identify a stream as a type1 font
    • isType1

      public static boolean isType1(byte[] startingBytes)
      Determines if startingBytes represents the start of a type1 font
      Parameters:
      startingBytes - The initial file bytes
      Returns:
      true iff the bytes appear to be the start of a type1 font
    • getNumBytesNeededToIdentifyAFM

      public static int getNumBytesNeededToIdentifyAFM()
      Returns the number of initial bytes necessary to identify a stream as an AFM
    • isAFM

      public static boolean isAFM(byte[] startingBytes)
      Determines if startingBytes represents the start of an AFM
      Parameters:
      startingBytes - The initial file bytes
      Returns:
      true iff the bytes appear to be the start of a afm
    • getNumBytesNeededToIdentifyPFM

      public static int getNumBytesNeededToIdentifyPFM()
      Returns the number of initial bytes necessary to identify a stream as a PFM
    • isPFM

      public static boolean isPFM(byte[] startingBytes)
      Determines if startingBytes represents the start of a PFM
      Parameters:
      startingBytes - The initial file bytes
      Returns:
      true iff the bytes appear to be the start of a pfm
    • load

      Given an input stream, creates Type1Font objects that represent it. Note that fonts are parsed at this point. Also note that multiple master fonts are not supported by AFE. Calling this function with a multiple master font will cause an exception to be thrown.
      Parameters:
      in - The input stream
      Returns:
      An array of type1 fonts
      Throws:
      IOException - Thrown if the stream cannot be read
      InvalidFontException - Thrown if the stream does not represent a valid type1 font.
      UnsupportedFontException
    • loadAFM

      public static MetricFile loadAFM(FontInputStream str, URL url) throws IOException, InvalidFontException
      If the stream contains an AFM, it creates an AFM and returns it. Note that AFMs are parsed at this point
      Parameters:
      str - The stream to be probed.
      Returns:
      null if str is not an AFM. A valid AFM object otherwise.
      Throws:
      IOException - Thrown if the stream cannot be read
      InvalidFontException - Thrown if the stream does not represent a valid AFM
    • loadPFM

      public static MetricFile loadPFM(FontInputStream str, URL url) throws IOException, InvalidFontException
      If the stream contains an PFM, it creates an PFM object and returns it. Note that PFMs are parsed at this point
      Parameters:
      str - The stream to be probed.
      Returns:
      null if str is not an PFM. A valid PFM object otherwise.
      Throws:
      IOException - Thrown if the stream cannot be read
      InvalidFontException