Documentation
¶
Overview ¶
Package psinterpreter implement a Postscript interpreter required to parse .CFF files, and Type1 and Type2 Charstrings. This package provides the low-level mechanisms needed to read such formats; the data is consumed in higher level packages, which implement `PsOperatorHandler`. It also provides helpers to interpret glyph outline descriptions, shared between Type1 and CFF font formats.
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ( // ErrInterrupt signals the interpreter to stop early, without erroring. ErrInterrupt = errors.New("interruption") )
Functions ¶
This section is empty.
Types ¶
type ArgStack ¶
type ArgStack struct { Vals [psArgStackSize]int32 // Effecive size currently in use. The first value to // pop is at index Top-1 Top int32 }
func (*ArgStack) Float ¶
Float return the top level value as a real number (which is stored as its binary representation), without popping the stack.
func (*ArgStack) Pop ¶
Pop returns the top level value and decrease `Top` It will panic if the stack is empty.
type Machine ¶
type Machine struct { ArgStack ArgStack // contains filtered or unexported fields }
Machine is a PostScript interpreter. A same interpreter may be re-used using muliples `Run` calls.
func (*Machine) CallSubroutine ¶
CallSubroutine calls the subroutine, identified by its index, as found in the instructions (that is, before applying the subroutine biased). `isLocal` controls whether the local or global subroutines are used. No argument stack modification is performed.
type PsOperator ¶
PsOperator is a postcript command, which may be escaped.
func (PsOperator) String ¶
func (p PsOperator) String() string
type PsOperatorHandler ¶
type PsOperatorHandler interface { // Context defines the precise behaviour of the interpreter, // which has small nuances depending on the context. Context() PsContext // Apply implements the operator defined by `operator` (which is the second byte if `escaped` is true). // // Returning `ErrInterrupt` stop the parsing of the instructions, without reporting an error. // It can be used as an optimization. Apply(operator PsOperator, state *Machine) error }
PsOperatorHandler defines the behaviour of an operator.