public static LineToPrint Get(int index, Graphics g, PointF pos, float width, RichTextBox rtb, ref WordToPrint nextWord, out int nextIndex) { LineToPrint line = new LineToPrint(); if (nextWord != null) { line.Append(nextWord); pos.X += nextWord.Size.Width; } nextWord = null; int i = index; while (i < rtb.Text.Length) { WordToPrint word = WordToPrint.Get(i, g, pos, rtb); i += word.Length; if (word.IsLineBreak) { // throw it away? break; } else if (word.Size.Width + line.Size.Width < width) { line.Append(word); pos.X += word.Size.Width; } else { nextWord = word; break; } } nextIndex = i; return(line); }
public static LineToPrint Get(int index, Graphics g, PointF pos, float width, RichTextBox rtb, ref WordToPrint nextWord, out int nextIndex) { LineToPrint line = new LineToPrint(); if (nextWord != null) { line.Append (nextWord); pos.X += nextWord.Size.Width; } nextWord = null; int i = index; while (i < rtb.Text.Length) { WordToPrint word = WordToPrint.Get (i, g, pos, rtb); i += word.Length; if (word.IsLineBreak) { // throw it away? break; } else if (word.Size.Width + line.Size.Width < width) { line.Append (word); pos.X += word.Size.Width; } else { nextWord = word; break; } } nextIndex = i; return line; }