Advanced wrapping algorithm that will wrap words as the line grows longer than its horizontal bounds. Consecutive spaces will be collapsed and replaced with a single space. Lines will be trimmed of white space before processing. Throws an error if wordWrapWidth is less than a single character.
name | type | description |
---|---|---|
text | string |
The text to perform word wrap detection against. |
context | CanvasRenderingContext2D |
The Canvas Rendering Context. |
wordWrapWidth | number |
The word wrap width. |
The wrapped text.