CharStringVisitor

Trait CharStringVisitor 

Source
pub trait CharStringVisitor<T: Debug, E: Error> {
    // Provided methods
    fn visit(
        &mut self,
        _op: VisitOp,
        _stack: &ArgumentsStack<'_, T>,
    ) -> Result<(), E> { ... }
    fn enter_subr(&mut self, _index: SubroutineIndex) -> Result<(), E> { ... }
    fn exit_subr(&mut self) -> Result<(), E> { ... }
    fn enter_seac(&mut self, _seac: SeacChar, _dx: T, _dy: T) -> Result<(), E> { ... }
    fn exit_seac(&mut self, _seac: SeacChar) -> Result<(), E> { ... }
    fn hint_data(&mut self, _op: VisitOp, _hints: &[u8]) -> Result<(), E> { ... }
}
Expand description

Trait for types that can be used to traverse a CFF CharString.

Used in conjunction with CharStringVisitorContext. The visitor will receive a visit call for each operator with its operands. All methods are optional as they have default no-op implementations.

Provided Methods§

Source

fn visit( &mut self, _op: VisitOp, _stack: &ArgumentsStack<'_, T>, ) -> Result<(), E>

Called for each operator in the CharString, except for callsubr and callgsubr — these are handled by enter/exit_subr.

Source

fn enter_subr(&mut self, _index: SubroutineIndex) -> Result<(), E>

Called prior to entering a subroutine.

The index argument indicates the type of subroutine (local/global) and holds its index.

Source

fn exit_subr(&mut self) -> Result<(), E>

Called when returning from a subroutine.

Source

fn enter_seac(&mut self, _seac: SeacChar, _dx: T, _dy: T) -> Result<(), E>

Called before entering a component of an accented character.

The seac argument indicates if it’s the base or accent character. dx and dy are the x and y position of the accent character. The same values will be supplied for both the base and accent.

Source

fn exit_seac(&mut self, _seac: SeacChar) -> Result<(), E>

Called when returning from a component of an accented character.

seac indicates whether it’s the base or accent.

Source

fn hint_data(&mut self, _op: VisitOp, _hints: &[u8]) -> Result<(), E>

Called with the hint data that follows the hintmask and cntrmask operators.

This function will be called after a visit invocation for the operators.

Implementors§