Пример #1
0
 public PositionedChunk(JustifiedTextChunkView <TDocument> chunk, int line, int x, float baseLine)
 {
     Chunk    = chunk;
     Line     = line;
     X        = x;
     BaseLine = baseLine;
     EndOffsetWithoutLineBreaks = chunk.EndOffsetWithoutLineBreaks;
 }
Пример #2
0
        int AddNodes(List <ITextChunkView <TDocument> > lineContent, bool justified, Size size)
        {
            if (justified)
            {
                // Justified content covers the whole line. We need to break the text into words to insert the extra
                // spaces on rendering.
                var jc = new JustifiedTextChunkView <TDocument>(this.viewFactory.TextProcessingRules, Node, Style, lineContent);
                jc.Measure(size);
                lineBreakContent.Add(new PositionedChunk(jc, lineMetrics.Count, 0, jc.BaseLine));
                return(1);
            }

            int pos = 0;

            for (var i = 0; i < lineContent.Count; i++)
            {
                var currentChunk = lineContent[i];
                lineBreakContent.Add(new PositionedChunk(currentChunk, lineMetrics.Count, pos, currentChunk.BaseLine));
                pos += currentChunk.DesiredSize.WidthInt;
            }
            return(lineContent.Count);
        }