On this page:
tblock
lines->tblock
baseline!
tblock/  any
->tblock
8.12

1 Text block datatype🔗ℹ

 (require text-block/tblock) package: text-block

struct

(struct tblock (width height baseline lines))

  width : exact-nonnegative-integer?
  height : exact-nonnegative-integer?
  baseline : exact-nonnegative-integer?
  lines : (listof string?)
The tblock structure. Do not use tblock for construction, use lines->tblock or ->tblock instead.

Only the baseline field is mutable.

procedure

(lines->tblock lines    
  [#:align align    
  #:pad-char pad-char    
  #:baseline baseline])  tblock?
  lines : (or/c string? (listof string?))
  align : (one-of/c 'left 'center 'right) = 'left
  pad-char : char? = #\space
  baseline : exact-nonnegative-integer? = 0
Returns a new tblock.

procedure

(baseline! t b)  tblock?

  t : tblock/any
  b : exact-nonnegative-integer?
Sets the baseline of t to b and returns t.

procedure

(tblock/any x)  boolean?

  x : any/c
A fake contract equivalent to any/c. Used as a placeholder to indicate that the corresponding argument is turned into a tblock using ->tblock.

procedure

(->tblock x)  tblock?

  x : tblock/any
Returns x if it is already a tblock?, otherwise returns a new tblock by turning x into a string first using ~a.