1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86
|
.. default-domain:: js
.. highlight:: javascript
StructuredTextWalker
====================
A structured text walker is an object with (optional) callback methods
used to iterate over the contents of a `StructuredText`.
Constructors
------------
.. class:: StructuredTextWalker
|interface_type|
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.
.. function:: beginTextBlock(bbox)
Called before every text block in the `StructuredText`.
:param Rect bbox:
.. function:: endTextBlock()
Called after every text block.
.. function:: beginLine(bbox, wmode, direction)
Called before every line of text in a block.
:param Rect bbox:
:param number wmode:
:param Point direction:
.. function:: endLine()
Called after every line of text.
.. function:: beginStruct(standard, raw, index)
Called to indicate that a new structure element begins. May not
be neatly nested within blocks or lines.
:param string standard:
:param string raw:
:param number index:
.. function:: endStruct()
Called after every structure element.
.. function:: onChar(c, origin, font, size, quad, color, flags)
Called for every character in a line of text.
:param string c:
:param Point origin:
:param Font font:
:param number size:
:param Quad quad:
:param Color color:
:param number flags:
.. function:: onImageBlock(bbox, transform, image)
Called for every image in a `StructuredText` if its options were
set to preserve images.
:param Rect bbox:
:param Matrix transform:
:param Image image:
.. function:: onVector(bbox, flags, rgb)
Called for every vector in a `StructuredText` if its options
were set to collect vectors.
:param Rect bbox:
:param Object flags:
:param Array of number rgb:
The flags object is of the form ``{ isStroked: boolean, isRectangle: boolean }``.
|