FormatResult FormatAsWord(XUnit width)
{
VerticalLineInfo newVertInfo = CalcCurrentVerticalInfo();
Rectangle rect = this.formattingArea.GetFittingRect(this.currentYPosition, newVertInfo.height + BottomBorderOffset);
if (rect == null)
return FormatResult.NewArea;
if (this.currentXPosition + width <= rect.X + rect.Width - this.RightIndent + Tolerance)
{
this.savedWordWidth = width;
this.currentXPosition += width;
// For Tabs in justified context
if (!this.IgnoreHorizontalGrowth)
this.currentWordsWidth += width;
if (this.savedBlankWidth > 0)
{
// For Tabs in justified context
if (!this.IgnoreHorizontalGrowth)
++this.currentBlankCount;
}
// For Tabs in justified context
if (!this.IgnoreHorizontalGrowth)
this.currentLineWidth += width + PopSavedBlankWidth();
this.currentVerticalInfo = newVertInfo;
this.minWidth = Math.Max(this.minWidth, width);
return FormatResult.Continue;
}
else
{
savedWordWidth = width;
return FormatResult.NewLine;
}
}