NextPrevUpTopContentsIndex

13.4.1 The Text Protocol

The following generic functions comprise the text protocol. Any extended output stream class must implement methods for these generic functions.

stream-character-width [Generic Function]

Arguments: stream character &key text-style

Summary: Returns a rational number corresponding to the amount of horizontal motion of the cursor position that would occur if the character character were output to the extended output stream stream in the text style text-style (which defaults to the current text style for the stream). This ignores the stream's text margin.

stream-string-width [Generic Function]

Arguments: stream string &key start end text-style

Summary: Computes how the cursor position would move horizontally if the string string were output to the extended output stream stream in the text style text-style (which defaults to the current text style for the stream) starting at the left margin. This ignores the stream's text margin.

The first returned value is the x coordinate that the cursor position would move to. The second returned value is the maximum x coordinate the cursor would visit during the output. (This is the same as the first value unless the string contains a #\Newline character.)

start and end are integers that default to 0 and the string length, respectively.

stream-text-margin [Generic Function]

Arguments: stream

(setf stream-text-margin) [Generic Function]

Arguments: margin stream

Summary: Returns the x coordinate at which text wraps around on the extended output stream stream (see stream-end-of-line-action ). The default setting is the width of the viewport, which is the right-hand edge of the viewport when it is horizontally scrolled to the "initial position."

You can use setf with stream-text-margin to establish a new text margin. If margin is nil , then the width of the viewport will be used. If the width of the viewport is later changed, the text margin will change, too.

stream-line-height [Generic Function]

Arguments: stream &key text-style

Summary: Returns what the line height of a line on the extended output stream stream containing text in the text style text-style would be, as a rational number. text-style defaults to the current text style for the stream.

stream-vertical-spacing [Generic Function]

Arguments: stream

Summary: Returns the current inter-line spacing (as a rational number) for the extended output stream stream .

stream-baseline [Generic Function]

Arguments: stream

Summary: Returns the current text baseline (as a rational number) for the extended output stream stream .


CommonLisp Interface Manager 2.0 User's Guide - 18 Mar 2005

NextPrevUpTopContentsIndex