wrapWords()

Synopsis

Returns a list of strings, which contains the original string broken into chunks that are less than the given width wide. Spaces are the only character used for breaking the original string. This function does not support hyphenation, or breaking words. If the first word on a line is too large to fit, it will be placed anyway. Newlines can be used to force line breaks - that means using either ~n or actually placing a newline in the string. Note: this function is currently not precise, and does not use textWidth() to compute the width. However, because of its nature, precision is often not necessary. This does not use fonts, charHeight, or any other attributes of InkTextMixin. The string is limited to 1023 characters.

Syntax

wrapWords ( text As String, _
            boxWidth As Number, _
            lineHeight As Number ) As List 
Argument Type Description
text string The text to be broken into boxWidth-wide chunks.
boxWidth number The width of each line. Lines will break at approximately this length.
lineHeight number The approximate height for the characters. Currently the width of each character is assumed to be fixed at 0.75 times this height.

Example 1

Intent >wrapWords("Heat treat this area per ASTM-B210", 10, 1) 
--> {"Heat treat", "this area per", "ASTM-B210"} 

Example 2

Intent >wrapWords("The longest word in this sentence, antidisestablishmentarianism, doesn't wrap.", 10, 1) 
--> {"The longest", "word in this", "sentence,", "antidisestablishmentarianism,", "doesn't wrap."}