OutputBoxΒΆ

fmt.spad line 180 [edit on github]

The domain OutputBox represents the two-dimensional form of an expression by a number of strings (lines). Such a box has a baseline (at which such boxes will be horizontally aligned, a height (size above and including the baseline), a depth (size below the baseline), and a width (horizontal size).

box: String -> %

box(s) creates a box that contains the string s.

coerce: % -> OutputForm

from CoercibleTo OutputForm

depth: % -> NonNegativeInteger

depth(box) returns the height of the box below the baseline.

empty?: % -> Boolean

empty?(b) returns true of the box has height and depth equal to 0.

empty: () -> %

Create an empty box of size 0.

hcenter: NonNegativeInteger -> % -> %

hcenter(w)(box) centers the box horizontally inside a box of width w.

hconcat: List % -> %

hconcat(lbox) aligns the boxes at their baseline and concats those boxes horizontally from left to right.

height: % -> NonNegativeInteger

height(box) returns the height of the box (above the baseline) including the baseline.

lines: % -> List String

lines(box) returns the contents of the box as strings (all of the same length (width(box)).

pad: (NonNegativeInteger, NonNegativeInteger, NonNegativeInteger, NonNegativeInteger) -> % -> %

pad(t, b, l, r)(box) returns a new box that is padded by t empty lines at the top, b empty lines at the bottom, l space characters at the left, r space characters at the right. If w, h, d are the width, height and depth of box then the resulting box will have width l+w+r and height t+h and depth d+b.

vconcat: (List %, NonNegativeInteger) -> %

vconcat(lbox, h) returns vconcat(lbox,h, 0),

vconcat: (List %, NonNegativeInteger, Integer) -> %

vconcat(lbox, h, adjust) computes the maximal width of the boxes in the list lbox; then if adjust<0, left adjusts, if adjust>0, right adjusts, and otherwise centers each smaller box in a new box of this maximal width and returns a box by putting all the boxes vertically on top of each other. The height of the new box is given by h, the depth results from the difference of the number of lines and h.

width: % -> NonNegativeInteger

width(box) returns the width of the box.

CoercibleTo OutputForm