From 7b6aecdb5964ccdb67dddb93e74a8301a2857132 Mon Sep 17 00:00:00 2001 From: "13.beta2" Date: Sun, 10 Jan 2016 23:47:14 +0300 Subject: [PATCH] Implement basic font rendering tuning for code editor. (2/2: Libraries part) Ability to disable anti-aliasing for 'pixel-perfect' fonts like Courier New. Ability to disable hinting to forget about jagged default WPF rendering. --- ICSharpCode.AvalonEdit/TextEditor.xaml | 1 + ICSharpCode.AvalonEdit/TextEditorOptions.cs | 44 +++++++++++++++++++++ 2 files changed, 45 insertions(+) diff --git a/ICSharpCode.AvalonEdit/TextEditor.xaml b/ICSharpCode.AvalonEdit/TextEditor.xaml index 20b19be0..57b3adc4 100644 --- a/ICSharpCode.AvalonEdit/TextEditor.xaml +++ b/ICSharpCode.AvalonEdit/TextEditor.xaml @@ -55,6 +55,7 @@ + diff --git a/ICSharpCode.AvalonEdit/TextEditorOptions.cs b/ICSharpCode.AvalonEdit/TextEditorOptions.cs index 5b0fa553..7158fc94 100644 --- a/ICSharpCode.AvalonEdit/TextEditorOptions.cs +++ b/ICSharpCode.AvalonEdit/TextEditorOptions.cs @@ -493,5 +493,49 @@ public bool AllowToggleOverstrikeMode { } } } + + bool enableTextAntialiasing = true; + + /// + /// Gets/Sets if anti-aliasing should be applied while text rendering. + /// + [DefaultValue(true)] + public bool EnableTextAntialiasing + { + get + { + return enableTextAntialiasing; + } + set + { + if (enableTextAntialiasing != value) + { + enableTextAntialiasing = value; + OnPropertyChanged("EnableTextAntialiasing"); + } + } + } + + bool enableTextHinting = true; + + /// + /// Gets/Sets if TrueType hinting should be applied while text rendering. + /// + [DefaultValue(true)] + public bool EnableTextHinting + { + get + { + return enableTextHinting; + } + set + { + if (enableTextHinting != value) + { + enableTextHinting = value; + OnPropertyChanged("EnableTextHinting"); + } + } + } } }