5.4 Rendering the Current Selection

The current selection is rendered by executing browser command read-current. The rendering commenced by read-current can be interrupted in two ways:

Another browser action is to render the rest of the document starting from the current selection. This is enabled by browser command read-rest (bound to c).

Moving the selection to the next or previous node and then rendering is a common sequence of actions. AS TE R provides commands read-previous and read-next (bound to p and n respectively) that combine these actions.

In addition, the browser provides command read-just-this-node (bound to r) that renders only the current node, rather than the entire subtree rooted at this node —this is useful when traversing complex mathematical expressions.

Relative Renderings

In the above paragraphs, we described the various browser actions that render the current selection. The current selection can be rendered either as if it occurs by itself or as it would be if it were rendered along with the rest of the document. The former is straightforward; we need only execute generic function read-aloud on the current selection. The latter presents an interesting problem.

Specifying that the current selection should be rendered relative to its position in the entire document is analogous to picking a word from the electronic encoding of a book and asking the question:

On what page in the book does this word appear?

In general, answering such a question would involve completely rendering the book. Analogously, rendering the current selection relative to its position in the document can be computationally intensive. We avoid this complexity by recording a pointer to the AFL state that is current when a document object is rendered. On the surface, this seems like it would require a lot of storage. In reality, this approach is both feasible and efficient, because the same AFL states are used to render a large number of the objects appearing in a document.

Recording of AFL states used to render specific objects is made possible by adding an extra slot named afl-state to object document. Initially, the value of this slot is nil, but when an object is rendered for the first time, a pointer to the AFL state that is current when the rendering commences is recorded in this slot. Relative renderings are produced by function read-current-relativelyshown below. Notice the use of the AFL block in setting up a lexical scope for the duration of the rendering. Locally setting the AFL state to that recorded in slot afl-state of the object being rendered is sufficient to achieve the desired relative rendering.

(defun read-current-relatively()

  "Render current selection relatively"



     ((afl-state ⋆read-pointer⋆)

      (afl:new-block                    ;retrieve state

       (afl:local-set-state (afl-state ⋆read-pointer⋆))

       (read-aloud ⋆read-pointer⋆ ) (afl:force-speech )))

     (t  (read-current )))))

Relative renderings are most useful when listening to tables and matrices. As described in the chapter on rendering rules (see Section 4.2), these are rendered using stereo effects, with the spatial location of the sound indicating the position of elements in the table. When moving through the elements of a table, hearing each element at the right spatial coordinate is useful in keeping track of the location of the current selection. Thus, the user can move the current selection to the rightmost column and then move down this column, hearing each element spoken on the right speaker. As another example of using relative renderings, consider traversing the right-hand side of Faa de Bruno’s formula shown in equation 4.5 on page 134. Moving to the subscript of the summation with _ and then executing read-current-relatively results in the constraint being rendered in the “subscript voice” —this cues the location of the current selection.