spell function
Lay out str left to right in font pixels.
Implementation
SpelledWord spell(String str, [PixelFontKind font = PixelFontKind.big]) {
final f = pixelFonts[font]!;
final letters = <SpelledLetter>[];
var x = 0;
for (var i = 0; i < str.length; i++) {
final ch = str[i];
final g = f.glyphs[ch] ?? f.glyphs[ch.toUpperCase()];
final w = g != null ? g.width : f.space;
letters.add(SpelledLetter(ch: ch, g: g, x: x, w: w, h: f.height));
x += w + f.gap;
}
return SpelledWord(letters: letters, w: math.max(0, x - f.gap), h: f.height);
}