Class CMapAwareDocumentFont


public class CMapAwareDocumentFont extends DocumentFont
Implementation of DocumentFont used while parsing PDF streams.
Since:
2.1.4
  • Constructor Details

    • CMapAwareDocumentFont

      public CMapAwareDocumentFont(PRIndirectReference refFont)
      Creates an instance of a CMapAwareFont based on an indirect reference to a font.
      Parameters:
      refFont - the indirect reference to a font
  • Method Details

    • getWidth

      public int getWidth(int char1)
      Description copied from class: DocumentFont
      Gets the width of a char in normalized 1000 units.
      Overrides:
      getWidth in class DocumentFont
      Parameters:
      char1 - the unicode char to get the width of
      Returns:
      the width in normalized 1000 units
      Since:
      2.1.5 Override to allow special handling for fonts that don't specify width of space character
      See Also:
    • decode

      public String decode(byte[] cidbytes, int offset, int len)
      Decodes a string of bytes (encoded in the font's encoding) into a unicode string This will use the ToUnicode map of the font, if available, otherwise it uses the font's encoding
      Parameters:
      cidbytes - the bytes that need to be decoded
      Returns:
      the unicode String that results from decoding
      Since:
      2.1.7
    • encode

      public String encode(byte[] bytes, int offset, int len)
      Deprecated.
      method name is not indicative of what it does. Use decode instead.
      Encodes bytes to a String.
      Parameters:
      bytes - the bytes from a stream
      offset - an offset
      len - a length
      Returns:
      a String encoded taking into account if the bytes are in unicode or not.