The estimating measurer (spec/05 §2): 0.6 em per grapheme, whatever the font, from
visualize's Visualize.Chart.Text.width/2.
iex> Macaw.Layers.Text.Estimate.width("Wednesday", "sans-serif", 11)
59.4
iex> Macaw.Layers.Text.Estimate.lines("one two three", "sans-serif", 10, 50)
["one two", "three"]width(text, font, size) = 0.6 × size × String.length(text), the number visualize's
estimate and macaw_frame's Macaw.Draw.Text.width/2 give for the text at that size, so
a layout moving onto the seam keeps its numbers. No font is read: a wide glyph runs over
the estimate. It is Macaw.Layers.Text's default measurer.
lines/4 breaks at word boundaries: each line of the text (a newline always breaks) is
its words, separated by whitespace, set greedily, one space apart, as many to a line as
fit max_width by width/3. A word wider than max_width stands alone on its line,
never cut, and a line holding no word is "".
Both answer a value on any input: an argument of the wrong type is {:type, type} at
its name ([:text], [:font], [:size], [:max_width]), every one at once.
Summary
Types
@type error() :: {:error, [Macaw.Base.Fault.t(), ...]}
A refusal: every fault with its path.