public Highlight(Highlight copy) { Start = copy.Start; Length = copy.Length; Style = copy.Style; Weight = copy.Weight; Foreground = copy.Foreground; Background = copy.Background; }
private Point GetHighlightOffset(int lineWidth, Highlight highlight) { return new Point( this.GetFont().Width * (highlight.Start % lineWidth), this.GetFont().Height * (highlight.Start / lineWidth)); }
private Typeface CreateTypeface(Highlight highlight) { return new Typeface(FontFamily, highlight.Style, highlight.Weight, FontStretch); }
private FormattedText RenderHighlight(DrawingContext drawingContext, int line, Highlight highlight) { var font = this.GetFont(); int lineWidth = (int)(this.ActualWidth / font.Width); return new FormattedText( Line.Text.Substring(highlight.Start, highlight.Length), CultureInfo.CurrentUICulture, FlowDirection, CreateTypeface(highlight), FontSize, new SolidColorBrush(highlight.Foreground)) { MaxTextWidth = ActualWidth }; }
private void RenderHighlight(DrawingContext drawingContext, Highlight highlight) { RenderText(drawingContext, highlight.Foreground, highlight.Background, highlight.Start, highlight.Length); }
public static void Add(Regex regex, Highlight hilight) { Highlights[regex] = hilight; }
private FormattedText RenderHighlight(DrawingContext drawingContext, int line, Highlight highlight) { var font = this.GetFont(); int lineWidth = (int)(this.ActualWidth / font.Width); return(new FormattedText( Line.Text.Substring(highlight.Start, highlight.Length), CultureInfo.CurrentUICulture, FlowDirection, CreateTypeface(highlight), FontSize, new SolidColorBrush(highlight.Foreground)) { MaxTextWidth = ActualWidth }); }
private Typeface CreateTypeface(Highlight highlight) { return(new Typeface(FontFamily, highlight.Style, highlight.Weight, FontStretch)); }
private Point GetHighlightOffset(int lineWidth, Highlight highlight) { return(new Point( this.GetFont().Width *(highlight.Start % lineWidth), this.GetFont().Height *(highlight.Start / lineWidth))); }
private string Hilight(Dictionary<string, string> args) { Regex regex = new Regex(args["hilight"]); Highlight hilight = new Highlight(); if(args.ContainsKey("bg")) hilight.Background = Highlight.ParseColor(args["bg"]); if(args.ContainsKey("fg")) hilight.Foreground = Highlight.ParseColor(args["fg"]); if(args.ContainsKey("st")) hilight.Style = Highlight.ParseStyle(args["st"]); if(args.ContainsKey("wt")) hilight.Weight = Highlight.ParseWeight(args["wt"]); Highlighter.Add(regex, hilight); return ""; }