Valid only for <text>
subelements.
Similar to the text
attribute, except the provided string is automatically wrapped to fit within the reference bounding box.
Expects an object with a text
property and optional width
and height
, which can adjust the final size of the wrapped text. Negative values decrease the dimension (e.g. to add padding around the wrapped text); positive values increase the dimension. Percentage values are accepted as well.
If the text cannot fit into the bounding box as specified, the overflowing words are cut off. If the ellipsis
option is provided, an ellipsis string is inserted before the cutoff. If no words can fit into the bounding box at all, no text is inserted. See util.breakText for more info.
textWrap: {
text: 'lorem ipsum dolor sit amet consectetur adipiscing elit',
width: -10, // reference width minus 10
height: '50%', // half of the reference height
ellipsis: true // could also be a custom string, e.g. '...!?'
}