static IEnumerable<BrokenWord> WordBreak (FormatOptions format, string word, int lineLength)
{
var chars = word.ToCharArray ();
int startIndex = 0;
lineLength = Math.Max (lineLength, 1);
while (startIndex < word.Length) {
int length = Math.Min (format.MaxLineLength - lineLength, word.Length - startIndex);
if (char.IsSurrogatePair (word, startIndex + length - 1))
length--;
yield return new BrokenWord (chars, startIndex, length);
startIndex += length;
lineLength = 1;
}
yield break;
}