Пример #1
0
        private void BuildALine()
        {
            m_currentLine            = new ParaLine();
            m_spaceLeftOnCurrentLine = m_layoutInfo.MaxWidth - m_surroundWidth;

            if (m_lines.Count == 0)
            {
                m_currentLine.Top         = m_gapTop;
                m_spaceLeftOnCurrentLine -= m_layoutInfo.MpToPixelsY(m_para.Style.FirstLineIndent);
            }
            m_lines.Add(m_currentLine);
            m_lineSegTypes.Clear();
            while (!Finished)
            {
                if (!AddSomethingToLine())
                {
                    break;
                }
            }
            while (!FinalizeLine())
            {
                if (!Backtrack())
                {
                    break;
                }
            }
            if (m_lines.Count > 1)
            {
                ParaLine previous = m_lines[m_lines.Count - 2];
                previous.LastBox.Next = m_currentLine.FirstBox;
                m_currentLine.Top     = TopOfNextLine(previous, m_currentLine.Ascent);
            }
            m_currentLine.ArrangeBoxes(m_para.Style.ParaAlignment, m_gapLeft, m_gapRight,
                                       m_lines.Count == 1 ? m_layoutInfo.MpToPixelsY(m_para.Style.FirstLineIndent) : 0,
                                       m_layoutInfo.MaxWidth,
                                       TopDepth);
        }