OutputBoxΒΆ
fmt.spad line 180 [edit on github]
The domain OutputBox represents the two-dimensional form of an expresssion 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 strings.
- coerce: % -> OutputForm
from CoercibleTo OutputForm
- depth: % -> NonNegativeInteger
depth(box)returns the height of theboxbelow the baseline.
- empty?: % -> Boolean
empty?(b)returnstrueof 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 widthw.
- 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 thebox(above the baseline) including the baseline.
- lines: % -> List String
lines(box)returns the contents of theboxas 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 bytempty lines at the top,bempty lines at the bottom,lspace characters at the left,rspace characters at the right. Ifw,h,dare the widht, heigth and depth of box then the resulting box will have width l+w+r and heightt+hand depthd+b.
- vconcat: (List %, NonNegativeInteger) -> %
vconcat(lbox, h)returnsvconcat(lbox,h, 0),
- vconcat: (List %, NonNegativeInteger, Integer) -> %
vconcat(lbox, h, adjust)computes the maximal width of the boxes in the listlbox; then ifadjust<0, left adjusts, ifadjust>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 byh, the depth results from the difference of the number of lines andh.
- width: % -> NonNegativeInteger
width(box)returns the width of thebox.