|
// Copyright (c) AlphaSierraPapa for the SharpDevelop Team (for details please see \doc\copyright.txt)
// This code is distributed under the GNU LGPL (for details please see \doc\license.txt)
using System;
using System.Diagnostics;
using System.Windows.Media.TextFormatting;
namespace ICSharpCode.AvalonEdit.Rendering
{
sealed class SimpleTextSource : TextSource
{
readonly string text;
readonly TextRunProperties properties;
public SimpleTextSource(string text, TextRunProperties properties)
{
this.text = text;
this.properties = properties;
}
public override TextRun GetTextRun(int textSourceCharacterIndex)
{
if (textSourceCharacterIndex < text.Length)
return new TextCharacters(text, textSourceCharacterIndex, text.Length - textSourceCharacterIndex, properties);
else
return new TextEndOfParagraph(1);
}
public override int GetTextEffectCharacterIndexFromTextSourceCharacterIndex(int textSourceCharacterIndex)
{
throw new NotImplementedException();
}
public override TextSpan<CultureSpecificCharacterBufferRange> GetPrecedingText(int textSourceCharacterIndexLimit)
{
throw new NotImplementedException();
}
}
}
|
By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.
If a file you wish to view isn't highlighted, and is a text file (not binary), please
let us know and we'll add colourisation support for it.