...master 2026-11-12 (1037e2069+unstaged)

StructuredTextWalker

A structured text walker is an object with (optional) callback methods used to iterate over the contents of a StructuredText.

Constructors

class StructuredTextWalker()

This is an interface, not a concrete class!

On beginLine the direction parameter is a vector (e.g. [0, 1]) and can you can calculate the rotation as an angle with some trigonometry on the vector.

beginTextBlock(bbox)

Called before every text block in the StructuredText.

endTextBlock()

Called after every text block.

beginLine(bbox, wmode, direction)

Called before every line of text in a block.

endLine()

Called after every line of text.

beginStruct(standard, raw, index)

Called to indicate that a new structure element begins. May not be neatly nested within blocks or lines.

endStruct()

Called after every structure element.

onChar(c, origin, font, size, quad, color, flags)

Called for every character in a line of text.

onImageBlock(bbox, transform, image)

Called for every image in a StructuredText if its options were set to preserve images.

onVector(bbox, flags, rgb)

Called for every vector in a StructuredText if its options were set to collect vectors.

The flags object is of the form { isStroked: boolean, isRectangle: boolean }.