wrap-words ( words width -- lines )
Word object wrapping

Next:wrapping-word


Vocabulary
wrap.words

Inputs
wordsa sequence of a wrapping-words
widthan integer


Outputs
linesa sequence of sequences of words


Word description
Divides the words into lines, where the sum of the lengths of the words on a line (not counting breaks at the end of the line) is at most the given maximum. The returned set of lines is optimized to minimize the square of the deviation of each line from the ideal width. It is not guaranteed to be the minimal number of lines. Every line except for the first one starts with a non-break, and every one but the last ends with a break.

Definition