Class Type2CharStringParser

java.lang.Object
org.apache.fontbox.cff.Type2CharStringParser

public class Type2CharStringParser extends Object
This class represents a converter for a mapping into a Type2-sequence.
  • Field Details

    • hstemCount

      private int hstemCount
    • vstemCount

      private int vstemCount
    • sequence

      private List<Object> sequence
    • fontName

      private final String fontName
    • glyphName

      private final String glyphName
  • Constructor Details

    • Type2CharStringParser

      public Type2CharStringParser(String fontName, String glyphName)
      Constructs a new Type1CharStringParser object for a Type 1-equivalent font.
      Parameters:
      fontName - font name
      glyphName - glyph name
    • Type2CharStringParser

      public Type2CharStringParser(String fontName, int cid)
      Constructs a new Type1CharStringParser object for a CID-Keyed font.
      Parameters:
      fontName - font name
      cid - CID
  • Method Details

    • parse

      public List<Object> parse(byte[] bytes, byte[][] globalSubrIndex, byte[][] localSubrIndex) throws IOException
      The given byte array will be parsed and converted to a Type2 sequence.
      Parameters:
      bytes - the given mapping as byte array
      globalSubrIndex - array containing all global subroutines
      localSubrIndex - array containing all local subroutines
      Returns:
      the Type2 sequence
      Throws:
      IOException - if an error occurs during reading
    • parse

      private List<Object> parse(byte[] bytes, byte[][] globalSubrIndex, byte[][] localSubrIndex, boolean init) throws IOException
      Throws:
      IOException
    • readCommand

      private CharStringCommand readCommand(int b0, DataInput input) throws IOException
      Throws:
      IOException
    • readNumber

      private Number readNumber(int b0, DataInput input) throws IOException
      Throws:
      IOException
    • getMaskLength

      private int getMaskLength()
    • peekNumbers

      private List<Number> peekNumbers()