Esempio n. 1
0
 internal LineLayout(font.TextLayout layout,
                     TextLineIterator lineIter,
                     float accumulatedHeight)
 {
     _layout            = layout;
     _lineIter          = lineIter;
     _accumulatedHeight = accumulatedHeight;
 }
Esempio n. 2
0
		internal LineLayout(font.TextLayout layout,
			TextLineIterator lineIter,
			float accumulatedHeight) {

			_layout = layout;
			_lineIter = lineIter;
			_accumulatedHeight = accumulatedHeight;
		}
Esempio n. 3
0
        LineLayout NextTextLayoutFromMeasurer()
        {
            if (_accumulatedHeight >= WrapHeight)
            {
                _charsConsumed += _currentPos;
                return(null);
            }

            int limit = _measurer.getLineBreakIndex(_currentPos, WrapWidth);

            int wordBreak = limit;

            if (wordBreak < _currentRun)
            {
                while (wordBreak >= _currentPos && char.IsLetterOrDigit(_s, _charsConsumed + wordBreak))
                {
                    wordBreak--;
                }

                if (wordBreak > _currentPos)
                {
                    limit = wordBreak + 1;
                }
            }
            font.TextLayout layout = _measurer.getLayout(_currentPos, limit);

            LineLayout lineLayout = new LineLayout(
                layout,
                this,
                _accumulatedHeight);

            float lineHeight = PadHeight(lineLayout.Ascent + lineLayout.Descent + lineLayout.Leading);

            if (Format.LineLimit && (_accumulatedHeight + lineHeight > WrapHeight))
            {
                _charsConsumed += _currentPos;
                return(null);
            }

            _accumulatedHeight += lineHeight + lineLayout.Leading;

            _currentPos = limit;

            while (_currentPos < _currentRun)
            {
                if (char.IsWhiteSpace(_s, _charsConsumed + _currentPos))
                {
                    _currentPos++;
                }
                else
                {
                    break;
                }
            }
            return(lineLayout);
        }