TextWrap
namespace Griff.Scenes;
public static class TextWrapBreaking text onto more lines between words, so it fits a width: a Text with a WrapWidth (broken by its font’s own letter widths as it’s drawn), a dialogue box’s lines, a log’s.
Methods
Section titled “Methods”public static void Break(string text, float width, Func<int, int, float> measure, List<ValueTuple<int, int>> lines)The lines text is drawn on, added to lines as where each starts and ends in it: a line at each new line (\n), and each of those broken between words where the next word would take it wider than width (the space there dropped). measure says how wide the text from a start up to an end is, in the width’s units; a word wider than the width has a line to itself. A width of 0 or less breaks only at new lines. Makes no garbage, so it can run every time text is drawn.