Browse Source

add support for FontWeight and FontStyle to ITextMarker

newNRvisualizers
Siegfried Pammer 13 years ago
parent
commit
c7f91f7d3f
  1. 31
      src/AddIns/DisplayBindings/AvalonEdit.AddIn/Src/TextMarkerService.cs
  2. 11
      src/Main/Base/Project/Src/Editor/ITextMarker.cs

31
src/AddIns/DisplayBindings/AvalonEdit.AddIn/Src/TextMarkerService.cs

@ -120,6 +120,13 @@ namespace ICSharpCode.AvalonEdit.AddIn
if (foregroundBrush != null) { if (foregroundBrush != null) {
element.TextRunProperties.SetForegroundBrush(foregroundBrush); element.TextRunProperties.SetForegroundBrush(foregroundBrush);
} }
Typeface tf = element.TextRunProperties.Typeface;
element.TextRunProperties.SetTypeface(new Typeface(
tf.FontFamily,
marker.FontStyle ?? tf.Style,
marker.FontWeight ?? tf.Weight,
tf.Stretch
));
} }
); );
} }
@ -280,6 +287,30 @@ namespace ICSharpCode.AvalonEdit.AddIn
} }
} }
FontWeight? fontWeight;
public FontWeight? FontWeight {
get { return fontWeight; }
set {
if (fontWeight != value) {
fontWeight = value;
Redraw();
}
}
}
FontStyle? fontStyle;
public FontStyle? FontStyle {
get { return fontStyle; }
set {
if (fontStyle != value) {
fontStyle = value;
Redraw();
}
}
}
public object Tag { get; set; } public object Tag { get; set; }
TextMarkerTypes markerTypes; TextMarkerTypes markerTypes;

11
src/Main/Base/Project/Src/Editor/ITextMarker.cs

@ -3,6 +3,7 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Windows;
using System.Windows.Media; using System.Windows.Media;
namespace ICSharpCode.SharpDevelop.Editor namespace ICSharpCode.SharpDevelop.Editor
@ -52,6 +53,16 @@ namespace ICSharpCode.SharpDevelop.Editor
/// </summary> /// </summary>
Color? ForegroundColor { get; set; } Color? ForegroundColor { get; set; }
/// <summary>
/// Gets/Sets the font weight.
/// </summary>
FontWeight? FontWeight { get; set; }
/// <summary>
/// Gets/Sets the font style.
/// </summary>
FontStyle? FontStyle { get; set; }
/// <summary> /// <summary>
/// Gets/Sets the type of the marker. Use TextMarkerType.None for normal markers. /// Gets/Sets the type of the marker. Use TextMarkerType.None for normal markers.
/// </summary> /// </summary>

Loading…
Cancel
Save