Class PDFontFactory

java.lang.Object
org.apache.pdfbox.pdmodel.font.PDFontFactory

public final class PDFontFactory extends Object
Creates the appropriate font subtype based on information in the dictionary.
  • Field Details

  • Constructor Details

    • PDFontFactory

      private PDFontFactory()
  • Method Details

    • createFont

      public static PDFont createFont(COSDictionary dictionary) throws IOException
      Creates a new PDFont instance with the appropriate subclass.
      Parameters:
      dictionary - a font dictionary
      Returns:
      a PDFont instance, based on the SubType entry of the dictionary
      Throws:
      IOException - if something goes wrong
    • createFont

      public static PDFont createFont(COSDictionary dictionary, ResourceCache resourceCache) throws IOException
      Creates a new PDFont instance with the appropriate subclass.
      Parameters:
      dictionary - a font dictionary
      resourceCache - resource cache, only useful for type 3 fonts, can be null
      Returns:
      a PDFont instance, based on the SubType entry of the dictionary
      Throws:
      IOException - if something goes wrong
    • fixType0Subtype

      private static void fixType0Subtype(COSDictionary descendantFont, COSDictionary fontDescriptor, COSName newSubType)
    • getFontTypeFromFont

      private static PDFontFactory.FontType getFontTypeFromFont(COSDictionary fontDescriptor, COSName fontType) throws IOException
      Throws:
      IOException
    • isTrueTypeFile

      private static boolean isTrueTypeFile(byte[] header)
    • isTrueTypeCollectionFile

      private static boolean isTrueTypeCollectionFile(byte[] header)
    • isOpenTypeFile

      private static boolean isOpenTypeFile(byte[] header)
    • isType1File

      private static boolean isType1File(byte[] header)
    • isPfbFile

      private static boolean isPfbFile(byte[] header)
    • isCFFFile

      private static boolean isCFFFile(byte[] header)
    • getFontDescriptor

      private static COSDictionary getFontDescriptor(COSDictionary dictionary)
    • getDescendantFont

      private static COSDictionary getDescendantFont(COSDictionary dictionary)
    • getFontHeader

      private static byte[] getFontHeader(COSDictionary fontDescriptor) throws IOException
      Throws:
      IOException
    • createDescendantFont

      static PDCIDFont createDescendantFont(COSDictionary dictionary, PDType0Font parent) throws IOException
      Creates a new PDCIDFont instance with the appropriate subclass.
      Parameters:
      dictionary - descendant font dictionary
      Returns:
      a PDCIDFont instance, based on the SubType entry of the dictionary
      Throws:
      IOException - if something goes wrong