pub fn wrap_text(
msg: &str,
max_width: u32,
wrap: Wrap,
max_lines: Option<usize>,
measure: &mut dyn FnMut(&str) -> u32,
) -> (Vec<String>, bool)Expand description
Breaks text into lines no wider than a width.
Explicit \n always starts a new line (an empty line stays empty). With Wrap::Word lines
break at spaces (runs of spaces collapse to one) and a word wider than the width is broken
between graphemes; with Wrap::Anywhere they break between graphemes. Wrap::None only
splits at \n. If max_lines is set and the text needs more lines, the last line is cut
and ends in an ellipsis.
§Arguments
msg- The text.max_width- The width in pixels each line must fit (a single grapheme wider than this is still put on its own line).wrap- How to break lines.max_lines- The most lines to return (at least one is returned), orNonefor no limit.measure- Returns the width in pixels of a string in the font being drawn.
§Returns
The lines, top to bottom, and whether the last line was cut to honor max_lines.