MigraDoc.Rendering.ParagraphRenderer.FormatTab C# (CSharp) Method

FormatTab() private method

Adjusts the current x position to the given tab stop if possible.
private FormatTab ( ) : FormatResult
return FormatResult
    FormatResult FormatTab()
    {
      // For Tabs in Justified context
      if (this.paragraph.Format.Alignment == ParagraphAlignment.Justify)
        this.reMeasureLine = true;
      TabStop nextTabStop = GetNextTabStop();
      this.savedWordWidth = 0;
      if (nextTabStop == null)
        return FormatResult.NewLine;

      bool notFitting = false;
      XUnit xPositionBeforeTab = this.currentXPosition;
      switch (nextTabStop.Alignment)
      {
        case TabAlignment.Left:
          this.currentXPosition = ProbeAfterLeftAlignedTab(nextTabStop.Position.Point, out notFitting);
          break;

        case TabAlignment.Right:
          this.currentXPosition = ProbeAfterRightAlignedTab(nextTabStop.Position.Point, out notFitting);
          break;

        case TabAlignment.Center:
          this.currentXPosition = ProbeAfterCenterAlignedTab(nextTabStop.Position.Point, out notFitting);
          break;

        case TabAlignment.Decimal:
          this.currentXPosition = ProbeAfterDecimalAlignedTab(nextTabStop.Position.Point, out notFitting);
          break;
      }
      if (!notFitting)
      {
        // For correct right paragraph alignment with tabs
        if (!this.IgnoreHorizontalGrowth)
          this.currentLineWidth += this.currentXPosition - xPositionBeforeTab;

        this.tabOffsets.Add(new TabOffset(nextTabStop.Leader, this.currentXPosition - xPositionBeforeTab));
        if (this.currentLeaf != null)
          this.lastTab = this.currentLeaf.Current;
      }

      return notFitting ? FormatResult.NewLine : FormatResult.Continue;
    }
ParagraphRenderer