diff --git a/src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/ICSharpCode.AvalonEdit.csproj b/src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/ICSharpCode.AvalonEdit.csproj
index b6b1bc0b21..4b76eeda25 100644
--- a/src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/ICSharpCode.AvalonEdit.csproj
+++ b/src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/ICSharpCode.AvalonEdit.csproj
@@ -234,6 +234,7 @@
IVisualLineTransformer.cs
+
IVisualLineTransformer.cs
diff --git a/src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/Rendering/DefaultTextRunTypographyProperties.cs b/src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/Rendering/DefaultTextRunTypographyProperties.cs
new file mode 100644
index 0000000000..f2e9fca09d
--- /dev/null
+++ b/src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/Rendering/DefaultTextRunTypographyProperties.cs
@@ -0,0 +1,128 @@
+// 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.Windows;
+using System.Windows.Media.TextFormatting;
+
+namespace ICSharpCode.AvalonEdit.Rendering
+{
+ ///
+ /// Default implementation for TextRunTypographyProperties.
+ ///
+ public class DefaultTextRunTypographyProperties : TextRunTypographyProperties
+ {
+ public override FontVariants Variants {
+ get { return FontVariants.Normal; }
+ }
+
+ public override bool StylisticSet1 { get { return false; } }
+ public override bool StylisticSet2 { get { return false; } }
+ public override bool StylisticSet3 { get { return false; } }
+ public override bool StylisticSet4 { get { return false; } }
+ public override bool StylisticSet5 { get { return false; } }
+ public override bool StylisticSet6 { get { return false; } }
+ public override bool StylisticSet7 { get { return false; } }
+ public override bool StylisticSet8 { get { return false; } }
+ public override bool StylisticSet9 { get { return false; } }
+ public override bool StylisticSet10 { get { return false; } }
+ public override bool StylisticSet11 { get { return false; } }
+ public override bool StylisticSet12 { get { return false; } }
+ public override bool StylisticSet13 { get { return false; } }
+ public override bool StylisticSet14 { get { return false; } }
+ public override bool StylisticSet15 { get { return false; } }
+ public override bool StylisticSet16 { get { return false; } }
+ public override bool StylisticSet17 { get { return false; } }
+ public override bool StylisticSet18 { get { return false; } }
+ public override bool StylisticSet19 { get { return false; } }
+ public override bool StylisticSet20 { get { return false; } }
+
+ public override int StylisticAlternates {
+ get { return 0; }
+ }
+
+ public override int StandardSwashes {
+ get { return 0; }
+ }
+
+ public override bool StandardLigatures {
+ get { return true; }
+ }
+
+ public override bool SlashedZero {
+ get { return false; }
+ }
+
+ public override FontNumeralStyle NumeralStyle {
+ get { return FontNumeralStyle.Normal; }
+ }
+
+ public override FontNumeralAlignment NumeralAlignment {
+ get { return FontNumeralAlignment.Normal; }
+ }
+
+ public override bool MathematicalGreek {
+ get { return false; }
+ }
+
+ public override bool Kerning {
+ get { return true; }
+ }
+
+ public override bool HistoricalLigatures {
+ get { return false; }
+ }
+
+ public override bool HistoricalForms {
+ get { return false; }
+ }
+
+ public override FontFraction Fraction {
+ get { return FontFraction.Normal; }
+ }
+
+ public override FontEastAsianWidths EastAsianWidths {
+ get { return FontEastAsianWidths.Normal; }
+ }
+
+ public override FontEastAsianLanguage EastAsianLanguage {
+ get { return FontEastAsianLanguage.Normal; }
+ }
+
+ public override bool EastAsianExpertForms {
+ get { return false; }
+ }
+
+ public override bool DiscretionaryLigatures {
+ get { return false; }
+ }
+
+ public override int ContextualSwashes {
+ get { return 0; }
+ }
+
+ public override bool ContextualLigatures {
+ get { return true; }
+ }
+
+ public override bool ContextualAlternates {
+ get { return true; }
+ }
+
+ public override bool CaseSensitiveForms {
+ get { return false; }
+ }
+
+ public override bool CapitalSpacing {
+ get { return false; }
+ }
+
+ public override FontCapitals Capitals {
+ get { return FontCapitals.Normal; }
+ }
+
+ public override int AnnotationAlternates {
+ get { return 0; }
+ }
+ }
+}
diff --git a/src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/Rendering/VisualLine.cs b/src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/Rendering/VisualLine.cs
index 8e2d67fdd6..fb0f0133d7 100644
--- a/src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/Rendering/VisualLine.cs
+++ b/src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/Rendering/VisualLine.cs
@@ -1,6 +1,7 @@
// 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.Linq;
using System.Windows.Controls;
using System.Windows.Media;
using ICSharpCode.AvalonEdit.Utils;
@@ -187,6 +188,15 @@ namespace ICSharpCode.AvalonEdit.Rendering
foreach (IVisualLineTransformer transformer in transformers) {
transformer.Transform(context, elements);
}
+ // For some strange reason, WPF requires that either all or none of the typography properties are set.
+ if (elements.Any(e => e.TextRunProperties.TypographyProperties != null)) {
+ // Fix typographic properties
+ foreach (VisualLineElement element in elements) {
+ if (element.TextRunProperties.TypographyProperties == null) {
+ element.TextRunProperties.SetTypographyProperties(new DefaultTextRunTypographyProperties());
+ }
+ }
+ }
}
internal void SetTextLines(List textLines)
diff --git a/src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/Rendering/VisualLineElementTextRunProperties.cs b/src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/Rendering/VisualLineElementTextRunProperties.cs
index b4011dcf9e..96a020bb7a 100644
--- a/src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/Rendering/VisualLineElementTextRunProperties.cs
+++ b/src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/Rendering/VisualLineElementTextRunProperties.cs
@@ -26,6 +26,8 @@ namespace ICSharpCode.AvalonEdit.Rendering
Typeface typeface;
TextDecorationCollection textDecorations;
TextEffectCollection textEffects;
+ TextRunTypographyProperties typographyProperties;
+ NumberSubstitution numberSubstitution;
///
/// Creates a new VisualLineElementTextRunProperties instance that copies its values
@@ -52,6 +54,8 @@ namespace ICSharpCode.AvalonEdit.Rendering
if (textEffects != null && !textEffects.IsFrozen) {
textEffects = textEffects.Clone();
}
+ typographyProperties = textRunProperties.TypographyProperties;
+ numberSubstitution = textRunProperties.NumberSubstitution;
}
///
@@ -203,5 +207,35 @@ namespace ICSharpCode.AvalonEdit.Rendering
ExtensionMethods.CheckIsFrozen(value);
textEffects = value;
}
+
+ ///
+ /// Gets the typography properties for the text run.
+ ///
+ public override TextRunTypographyProperties TypographyProperties {
+ get { return typographyProperties; }
+ }
+
+ ///
+ /// Sets the .
+ ///
+ public void SetTypographyProperties(TextRunTypographyProperties value)
+ {
+ typographyProperties = value;
+ }
+
+ ///
+ /// Gets the number substitution settings for the text run.
+ ///
+ public override NumberSubstitution NumberSubstitution {
+ get { return numberSubstitution; }
+ }
+
+ ///
+ /// Sets the .
+ ///
+ public void SetNumberSubstitution(NumberSubstitution value)
+ {
+ numberSubstitution = value;
+ }
}
}