blob: 8e9ac568bf0701497914305933b528344c5236fd (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
|
// 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 Tango.Scripting.Editors.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();
}
}
}
|