.
In Depth Banner
Skip Navigation Links

Select your preferred language

Centering a line.

    /// <summary>

    /// Calculates word positions for a centered line

    /// </summary>

    /// <param name="words">A reference to the line being repaginated</param>

    public void CenterLine(ref WordPosCollection words)

    {

      if(words.Count==0)

        return;

      TrimEnd(ref words);

      if(words.Count==0)

        return;

      TrimStart(ref words);

      if(words.Count==0)

        return;

      words[0].PagePos=(ColumnWidth/2) - (GetLineLength(ref words)/2) + LeftMargin;

      RePos(ref words);

    }

 

Return to the article

Copyright © Bob Powell 2000-.  All rights reserved.