Class FontFactory


  • public final class FontFactory
    extends java.lang.Object
    Creates font objects for OpenType fonts
    • Constructor Summary

      Constructors 
      Constructor Description
      FontFactory()  
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static int getNumBytesNeededToIdentify()  
      static boolean isOpenType​(byte[] startingBytes)
      Given the starting bytes of a font stream, returns true if the bytes indicate that the font is an opentype font.
      static OpenTypeFont[] load​(FontInputStream in)
      Given an input stream, creates OpenType FontData objects that represent it.
      static OpenTypeFont[] load​(FontInputStream in, java.lang.String base14CSSName, java.lang.String base14PSName)  
      • Methods inherited from class java.lang.Object

        equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • FontFactory

        public FontFactory()
    • Method Detail

      • load

        public static OpenTypeFont[] load​(FontInputStream in)
                                   throws java.io.IOException,
                                          InvalidFontException,
                                          UnsupportedFontException
        Given an input stream, creates OpenType FontData objects that represent it. Note that fonts are parsed at this point.
        Parameters:
        in - The input stream
        Returns:
        An array of OpenType fonts
        Throws:
        java.io.IOException - Thrown if the stream cannot be read
        InvalidFontException - Thrown if the stream does not represent a valid OpenType font.
        UnsupportedFontException - thrown if the stream contains information indicating that AFE does not support this class of fonts.
      • getNumBytesNeededToIdentify

        public static int getNumBytesNeededToIdentify()
        Returns:
        the number of starting bytes necessary to identify that a stream appears to be an opentype font.
      • isOpenType

        public static boolean isOpenType​(byte[] startingBytes)
        Given the starting bytes of a font stream, returns true if the bytes indicate that the font is an opentype font.
        Parameters:
        startingBytes - This inital bytes of an input stream.
        Returns:
        true iff the font appears to be an OpenType font.