blob: 1c8c7b1cc80fdafc0e6dc3d74a238dc86cc3b577 (
plain)
| ofs | hex dump | ascii |
|---|
| 0000 | 50 4b 03 04 14 00 06 00 08 00 00 00 21 00 86 af 43 9f 8f 01 00 00 6c 06 00 00 13 00 08 02 5b 43 | PK..........!...C.....l.......[C |
| 0020 | 6f 6e 74 65 6e 74 5f 54 79 70 65 73 5d 2e 78 6d 6c 20 a2 04 02 28 a0 00 02 00 00 00 00 00 00 00 | ontent_Types].xml....(.......... |
| 0040 | 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 | ................................ |
| 0060 | 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 | ................................ |
| 0080 | 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 | ................................ |
| 00a0 | 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 | ................................ |
| 00c0 | 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 | ................................ |
| 00e0 | 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 | ................................ |
| 0100 | 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 | ................................ |
| 0120 | 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 | ................................ |
| 0140 | 00 00 // 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.Collections.Generic;
using System.Windows.Media;
using System.Windows.Media.TextFormatting;
using Tango.Scripting.Editors.Utils;
namespace Tango.Scripting.Editors.Rendering
{
sealed class TextViewCachedElements : IDisposable
{
TextFormatter formatter;
Dictionary<string, TextLine> nonPrintableCharacterTexts;
public TextLine GetTextForNonPrintableCharacter(string text, ITextRunConstructionContext context)
{
if (nonPrintableCharacterTexts == null)
nonPrintableCharacterTexts = new Dictionary<string, TextLine>();
TextLine textLine;
if (!nonPrintableCharacterTexts.TryGetValue(text, out textLine)) {
var p = new VisualLineElementTextRunProperties(context.GlobalTextRunProperties);
p.SetForegroundBrush(context.TextView.NonPrintableCharacterBrush);
if (formatter == null)
formatter = TextFormatterFactory.Create(context.TextView);
textLine = FormattedTextElement.PrepareText(formatter, text, p);
nonPrintableCharacterTexts[text] = textLine;
}
return textLine;
}
public void Dispose()
{
if (nonPrintableCharacterTexts != null) {
foreach (TextLine line in nonPrintableCharacterTexts.Values)
line.Dispose();
}
if (formatter != null)
formatter.Dispose();
}
}
}
|