Class 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 Detail

      • FontFactory

        public FontFactory()
    • Method Detail

      • 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
      • 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