Interface Type2Consumer

  • All Known Implementing Classes:
    Type2ConsumerDefaultImpl

    public interface Type2Consumer
    Receives events as a Type2 charstring is parsed. There is one call per Type2 operator.

    We have four virtual operators:

    • integer and fraction are called when an integer or fraction operand appearing in the Type2 charstring is pushed on the stack
    • implicit_vstemhm is called when there is an implicit vstemhm operator before a hintmask or cntrmask operator
    • width is called if the charstring contains an advance width; this call can happen in a seemingly random relationship to the other operators

    Each call receives the current stack (which should not be modified, the interpreter will take care of popping the appropriate number of elements afterwards, and to push the result of operations if needed), and the stack depth. A few calls have additional arguments, as noted below.

    • Method Summary

      All Methods Instance Methods Abstract Methods 
      Modifier and Type Method Description
      void abs​(double[] stack, int stackDepth)  
      void add​(double[] stack, int stackDepth)  
      void and​(double[] stack, int stackDepth)  
      void callgsubr​(double[] stack, int stackDepth, int subr)  
      void callsubr​(double[] stack, int stackDepth, int subr)  
      void cntrmask​(double[] stack, int stackDepth, com.adobe.fontengine.font.cff.CFFByteArray data, int offset, int length)  
      void div​(double[] stack, int stackDepth)  
      void drop​(double[] stack, int stackDepth)  
      void dup​(double[] stack, int stackDepth)  
      void endchar​(double[] stack, int stackDepth)  
      void eq​(double[] stack, int stackDepth)  
      void exch​(double[] stack, int stackDepth)  
      void flex​(double[] stack, int stackDepth)  
      void flex1​(double[] stack, int stackDepth)  
      void get​(double[] stack, int stackDepth)  
      void globalColorMe​(double[] stack, int stackDepth)  
      void hflex​(double[] stack, int stackDepth)  
      void hflex1​(double[] stack, int stackDepth)  
      void hhcurveto​(double[] stack, int stackDepth)  
      void hintmask​(double[] stack, int stackDepth, com.adobe.fontengine.font.cff.CFFByteArray data, int offset, int length)  
      void hlineto​(double[] stack, int stackDepth)  
      void hmoveto​(double[] stack, int stackDepth)  
      void hstem​(double[] stack, int stackDepth)  
      void hstemhm​(double[] stack, int stackDepth)  
      void hvcurveto​(double[] stack, int stackDepth)  
      void ifelse​(double[] stack, int stackDepth)  
      void implicit_vstemhm​(double[] stack, int stackDepth)
      Called when there is vstemhm operator implied by a hintmask or cntrmask operator.
      void index​(double[] stack, int stackDepth)  
      void integer​(double[] stack, int stackDepth, int i)  
      void moveto​(double[] stack, int stackDepth)
      An absolute moveto (that is, a moveto that is not relative to the current point).
      void mul​(double[] stack, int stackDepth)  
      void neg​(double[] stack, int stackDepth)  
      void not​(double[] stack, int stackDepth)  
      void or​(double[] stack, int stackDepth)  
      void put​(double[] stack, int stackDepth)  
      void random​(double[] stack, int stackDepth)  
      void rcurveline​(double[] stack, int stackDepth)  
      void real​(double[] stack, int stackDepth, double a)  
      void return_op​(double[] stack, int stackDepth)  
      void rlinecurve​(double[] stack, int stackDepth)  
      void rlineto​(double[] stack, int stackDepth)  
      void rmoveto​(double[] stack, int stackDepth)  
      void roll​(double[] stack, int stackDepth)  
      void rrcurveto​(double[] stack, int stackDepth)  
      boolean seac​(double[] stack, int stackDepth)  
      void sqrt​(double[] stack, int stackDepth)  
      void sub​(double[] stack, int stackDepth)  
      void vhcurveto​(double[] stack, int stackDepth)  
      void vlineto​(double[] stack, int stackDepth)  
      void vmoveto​(double[] stack, int stackDepth)  
      void vstem​(double[] stack, int stackDepth)  
      void vstemhm​(double[] stack, int stackDepth)  
      void vvcurveto​(double[] stack, int stackDepth)  
      boolean width​(double w)  
    • Method Detail

      • hstem

        void hstem​(double[] stack,
                   int stackDepth)
      • vstem

        void vstem​(double[] stack,
                   int stackDepth)
      • vmoveto

        void vmoveto​(double[] stack,
                     int stackDepth)
      • rlineto

        void rlineto​(double[] stack,
                     int stackDepth)
      • hlineto

        void hlineto​(double[] stack,
                     int stackDepth)
      • vlineto

        void vlineto​(double[] stack,
                     int stackDepth)
      • rrcurveto

        void rrcurveto​(double[] stack,
                       int stackDepth)
      • callsubr

        void callsubr​(double[] stack,
                      int stackDepth,
                      int subr)
        Parameters:
        subr - the index of the local subroutine which is called.
      • return_op

        void return_op​(double[] stack,
                       int stackDepth)
      • and

        void and​(double[] stack,
                 int stackDepth)
      • or

        void or​(double[] stack,
                int stackDepth)
      • not

        void not​(double[] stack,
                 int stackDepth)
      • abs

        void abs​(double[] stack,
                 int stackDepth)
      • add

        void add​(double[] stack,
                 int stackDepth)
      • sub

        void sub​(double[] stack,
                 int stackDepth)
      • div

        void div​(double[] stack,
                 int stackDepth)
      • neg

        void neg​(double[] stack,
                 int stackDepth)
      • eq

        void eq​(double[] stack,
                int stackDepth)
      • drop

        void drop​(double[] stack,
                  int stackDepth)
      • put

        void put​(double[] stack,
                 int stackDepth)
      • get

        void get​(double[] stack,
                 int stackDepth)
      • ifelse

        void ifelse​(double[] stack,
                    int stackDepth)
      • random

        void random​(double[] stack,
                    int stackDepth)
      • mul

        void mul​(double[] stack,
                 int stackDepth)
      • sqrt

        void sqrt​(double[] stack,
                  int stackDepth)
      • dup

        void dup​(double[] stack,
                 int stackDepth)
      • exch

        void exch​(double[] stack,
                  int stackDepth)
      • index

        void index​(double[] stack,
                   int stackDepth)
      • roll

        void roll​(double[] stack,
                  int stackDepth)
      • hflex

        void hflex​(double[] stack,
                   int stackDepth)
      • flex

        void flex​(double[] stack,
                  int stackDepth)
      • hflex1

        void hflex1​(double[] stack,
                    int stackDepth)
      • flex1

        void flex1​(double[] stack,
                   int stackDepth)
      • endchar

        void endchar​(double[] stack,
                     int stackDepth)
      • hstemhm

        void hstemhm​(double[] stack,
                     int stackDepth)
      • hintmask

        void hintmask​(double[] stack,
                      int stackDepth,
                      com.adobe.fontengine.font.cff.CFFByteArray data,
                      int offset,
                      int length)
               throws InvalidFontException
        Parameters:
        data - holds the charstring (or subroutine) being interpreted
        offset - the index of the first byte representing the hintmask
        length - the number of bytes in the hintmask
        Throws:
        InvalidFontException
      • cntrmask

        void cntrmask​(double[] stack,
                      int stackDepth,
                      com.adobe.fontengine.font.cff.CFFByteArray data,
                      int offset,
                      int length)
               throws InvalidFontException
        Parameters:
        data - holds the charstring (or subroutine) being interpreted
        offset - the index of the first byte representing the cntrmask
        length - the number of bytes in the cntrmask
        Throws:
        InvalidFontException
      • rmoveto

        void rmoveto​(double[] stack,
                     int stackDepth)
      • hmoveto

        void hmoveto​(double[] stack,
                     int stackDepth)
      • moveto

        void moveto​(double[] stack,
                    int stackDepth)
        An absolute moveto (that is, a moveto that is not relative to the current point). stack[0] contains the new x. stack[1] contains the new y.
      • vstemhm

        void vstemhm​(double[] stack,
                     int stackDepth)
      • implicit_vstemhm

        void implicit_vstemhm​(double[] stack,
                              int stackDepth)
        Called when there is vstemhm operator implied by a hintmask or cntrmask operator.
      • rcurveline

        void rcurveline​(double[] stack,
                        int stackDepth)
      • rlinecurve

        void rlinecurve​(double[] stack,
                        int stackDepth)
      • vvcurveto

        void vvcurveto​(double[] stack,
                       int stackDepth)
      • hhcurveto

        void hhcurveto​(double[] stack,
                       int stackDepth)
      • callgsubr

        void callgsubr​(double[] stack,
                       int stackDepth,
                       int subr)
        Parameters:
        subr - the index of the global subroutine which is called.
      • vhcurveto

        void vhcurveto​(double[] stack,
                       int stackDepth)
      • hvcurveto

        void hvcurveto​(double[] stack,
                       int stackDepth)
      • integer

        void integer​(double[] stack,
                     int stackDepth,
                     int i)
        Parameters:
        i - the integer which is pushed on the stack by an integer operator.
      • real

        void real​(double[] stack,
                  int stackDepth,
                  double a)
        Parameters:
        a - the real number which is pushed on the stack by a 5 byte number operator.
      • width

        boolean width​(double w)
        Parameters:
        w - the width recorded in the charstring, to be added to the nominal width of the font; if this method is not called, the width of this outline is the default width of the font.
        Returns:
        true iff parsing should continue
      • seac

        boolean seac​(double[] stack,
                     int stackDepth)
        Parameters:
        stack - the stack containing the following params: Optionally, the advance width. If the stackDepth is 5, the first element on the stack is the width. adx: the horizontal position of the accent character relative to the base character's origin. ady: the vertical position of the accent character relative to the base character's origin. bchar: the character code of the base character in Standard Encoding. achar: the character code of the accent character in Standard Encoding.
        Returns:
        true if the parser should parse the base and accent characters. false if parsing should not recurse into those characters.
      • globalColorMe

        void globalColorMe​(double[] stack,
                           int stackDepth)