Example #1
0
        private IEnumerable <int> FindBlockTokenID(int tokenID)
        {
            while (tokenID >= 0)
            {
                _bookTokens.MoveTo(tokenID);
                _bookTokens.MoveNext();
                TokenBase current = _bookTokens.Current;
                if (current is PictureToken)
                {
                    yield return(tokenID);
                }

                var asOpenTagToken = current as TagOpenToken;
                if ((asOpenTagToken != null) && !asOpenTagToken.TextProperties.Inline)
                {
                    yield return(tokenID);
                }

                tokenID--;
            }
        }
Example #2
0
        public IEnumerable <TokenBlockBase> GetLines(BookTokenIterator bookTokens, string lastText, int firstTokenID,
                                                     int stopTokenID = -1, string stopText = null)
        {
            _firstTokenID = firstTokenID;

            _tree        = bookTokens.BuildTree(_firstTokenID);
            _lastOpenTag = _tree.Peek();
            _fontSize    = GetCurrentFontSize();
            _separator   = false;
            bool firstText = true;

            _marginLeft = _marginRight = 0.0;

            foreach (TagOpenToken openTagToken in _tree.Reverse())
            {
                EnterMargin(openTagToken.TextProperties);
            }

            if (string.IsNullOrEmpty(stopText) && stopTokenID > 0)
            {
                --stopTokenID;
            }

            while (bookTokens.MoveNext())
            {
                foreach (TokenBlockBase baseTokenLine in OutputLines(false))
                {
                    yield return(baseTokenLine);
                }

                if (!Append(bookTokens, lastText, stopTokenID, stopText, ref firstText))
                {
                    break;
                }
            }
            foreach (TokenBlockBase baseTokenLine in OutputLines(true))
            {
                yield return(baseTokenLine);
            }
        }