Constructor
new TextWrapper(measurementProvider)
Construct a text wrapper which will measure text using the specified measurement provider.
Parameters:
Name | Type | Description |
---|---|---|
measurementProvider |
MeasurementProvider | a helper object to provide text measurement services. |
Methods
wrapText(maxWidth, text) → {Array.<string>}
Wrap the provided text into lines restricted to a maximum width. See Unicode Standard Annex (UAX) #14.
Parameters:
Name | Type | Description |
---|---|---|
maxWidth |
number | the maximum allowed width of a line. |
text |
string | the text to be wrapped. Will be split on whitespace. |
Returns:
an array containing the wrapped lines of text.
- Type
- Array.<string>