public static TextLineRun Create(TextSource textSource, int index, int firstIndex, double lengthLeft, TextParagraphProperties paragraphProperties) { var textRun = textSource.GetTextRun(index); var stringRange = textRun.GetStringRange(); return(Create(textSource, stringRange, textRun, index, lengthLeft, paragraphProperties)); }
public static TextLineRun Create(TextSource textSource, int index, int firstIndex, int lengthLeft) { var textRun = textSource.GetTextRun(index); var stringRange = textRun.GetStringRange(); return(Create(textSource, stringRange, textRun, index, lengthLeft)); }
private static TextLineRun CreateRunForSpecialChars(TextSource textSource, StringRange stringRange, TextRun textRun, int index, TextParagraphProperties paragraphProperties) { switch (stringRange[0]) { case '\r': var runLength = 1; if (stringRange.Length > 1 && stringRange[1] == '\n') { runLength = 2; } else if (stringRange.Length == 1) { var nextRun = textSource.GetTextRun(index + 1); var range = nextRun.GetStringRange(); if (range.Length > 0 && range[0] == '\n') { var eolRun = new TextCharacters(NewlineString, textRun.Properties); return(new TextLineRun(eolRun.Length, eolRun) { IsEnd = true }); } } return(new TextLineRun(runLength, textRun) { IsEnd = true }); case '\n': return(new TextLineRun(1, textRun) { IsEnd = true }); case '\t': return(CreateRunForTab(textRun, paragraphProperties)); default: return(null); } }