Beispiel #1
0
 public Highlight(Highlight copy)
 {
     Start = copy.Start;
     Length = copy.Length;
     Style = copy.Style;
     Weight = copy.Weight;
     Foreground = copy.Foreground;
     Background = copy.Background;
 }
Beispiel #2
0
 private Point GetHighlightOffset(int lineWidth, Highlight highlight)
 {
     return new Point(
         this.GetFont().Width * (highlight.Start % lineWidth),
         this.GetFont().Height * (highlight.Start / lineWidth));
 }
Beispiel #3
0
 private Typeface CreateTypeface(Highlight highlight)
 {
     return new Typeface(FontFamily, highlight.Style, highlight.Weight, FontStretch);
 }
Beispiel #4
0
 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
         };
 }
Beispiel #5
0
 private void RenderHighlight(DrawingContext drawingContext, Highlight highlight)
 {
     RenderText(drawingContext, highlight.Foreground, highlight.Background, highlight.Start, highlight.Length);
 }
Beispiel #6
0
 public static void Add(Regex regex, Highlight hilight)
 {
     Highlights[regex] = hilight;
 }
Beispiel #7
0
        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
            });
        }
Beispiel #8
0
 private void RenderHighlight(DrawingContext drawingContext, Highlight highlight)
 {
     RenderText(drawingContext, highlight.Foreground, highlight.Background, highlight.Start, highlight.Length);
 }
Beispiel #9
0
 private Typeface CreateTypeface(Highlight highlight)
 {
     return(new Typeface(FontFamily, highlight.Style, highlight.Weight, FontStretch));
 }
Beispiel #10
0
 private Point GetHighlightOffset(int lineWidth, Highlight highlight)
 {
     return(new Point(
                this.GetFont().Width *(highlight.Start % lineWidth),
                this.GetFont().Height *(highlight.Start / lineWidth)));
 }
Beispiel #11
0
        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 "";
        }