Package com.adobe.fontengine.font.cff
Class Type2Parser
- java.lang.Object
-
- com.adobe.fontengine.font.cff.Type2Parser
-
public final class Type2Parser extends java.lang.Object
Parse a Type2 charstring. AType2Parser
offers a single method,parse
which is given a charstring and a Type2Consumer. As the charString is parsed, theType2Consumer
is called for each operator. The parser maintains the Type2 stack and storage area, interpreting the operators which affect them, as well as interpreting subroutine calls. The intent is that a Consumer can concentrate on dealing with the path and hints operators, and essentially ignore the arithmetic, storage, conditional and subroutine operators. However, all the operators are reported to the Consumer, so that it is for example possible to write a Consumer that creates an accurate textual representation of the charstring.The same parser can be used repeatedly to parse multiple charstrings; those charstrings do not need to be in the same font, nor even in the same font set. The parser maintains no state between invocations of
parse
.The consumer must not call
parse
on the parser that invoked it.Synchronization
This class is not synchronized. Theparse
method invokes the Type2Consumer on the thread on which it is called.
-
-
Constructor Summary
Constructors Constructor Description Type2Parser()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
parse(CharStrings charStrings, int index, CharStrings localSubrs, CharStrings globalSubrs, Type2Consumer c, NameKeyedFont font)
Decode a Type2 charstring.
-
-
-
Method Detail
-
parse
public void parse(CharStrings charStrings, int index, CharStrings localSubrs, CharStrings globalSubrs, Type2Consumer c, NameKeyedFont font) throws InvalidGlyphException, UnsupportedFontException
Decode a Type2 charstring.- Parameters:
charStrings
- theCharStrings
containing the charstringindex
- the index of the charstring incharStrings
localSubrs
- the local subroutinesglobalSubrs
- the global subroutinesc
- the Type2Consumer to alert of the parsing eventsfont
- The name-keyed font to which the charStrings belong, if they belong to a name-keyed font. If the font is cid-keyed, null should be passed in. font is only used to resolve seac glyphs, which can only be present in name-keyed fonts.- Throws:
InvalidGlyphException
- the charstring is malformed or missingUnsupportedFontException
-
-