Class PDFFontEncoding

java.lang.Object
org.loboevolution.pdfview.font.PDFFontEncoding

public class PDFFontEncoding extends Object
The PDFFont encoding encapsulates the mapping from character codes in the PDF document to glyphs of the font.

Encodings take two basic forms. For Type1, TrueType, and Type3 fonts, the encoding maps from character codes to Strings, which represent the glyphs of the font. For Type0 fonts, the mapping is a CMap which maps character codes to characters in one of many descendant fonts.

Note that the data in the PDF might be ASCII characters (bytes) or it might be a multi-byte format such as unicode. For now we will assume all glyph ids fit into at most the two bytes of a character.

  • Constructor Details

    • PDFFontEncoding

      public PDFFontEncoding(PDFCMap cmap)

      Constructor for PDFFontEncoding.

      Parameters:
      cmap - a PDFCMap object.
    • PDFFontEncoding

      public PDFFontEncoding(String fontType, PDFObject encoding) throws IOException
      Creates a new instance of PDFFontEncoding
      Parameters:
      fontType - a String object.
      encoding - a PDFObject object.
      Throws:
      IOException - if any.
  • Method Details

    • getGlyphs

      public List<PDFGlyph> getGlyphs(PDFFont font, String text)
      Get the glyphs associated with a given String
      Parameters:
      font - a PDFFont object.
      text - a String object.
      Returns:
      a List object.
    • parseEncoding

      public void parseEncoding(PDFObject encoding) throws IOException
      Parse a PDF encoding object for the actual encoding
      Parameters:
      encoding - a PDFObject object.
      Throws:
      IOException - if any.
    • isOneByteIdentity

      public boolean isOneByteIdentity()

      isOneByteIdentity.

      Returns:
      a boolean.