style<*>: use mono font for all contents

This commit is contained in:
leo 2024-02-18 10:41:41 +08:00
parent 70512915f9
commit c73c5372d2
15 changed files with 67 additions and 64 deletions

View file

@ -64,7 +64,7 @@ namespace SourceGit.Views {
if (string.IsNullOrEmpty(text)) return;
var normalTypeface = new Typeface(FontFamily, FontStyle.Normal, FontWeight.Normal, FontStretch.Normal);
var highlightTypeface = new Typeface(FontFamily, FontStyle.Normal, FontWeight.Bold, FontStretch.Normal);
//var highlightTypeface = new Typeface(FontFamily, FontStyle.Normal, FontWeight.Bold, FontStretch.Normal);
var underlinePen = new Pen(Foreground, 1);
var offsetX = 0.0;
@ -80,20 +80,20 @@ namespace SourceGit.Views {
part,
CultureInfo.CurrentCulture,
FlowDirection.LeftToRight,
isName ? highlightTypeface : normalTypeface,
//isName ? highlightTypeface : normalTypeface,
normalTypeface,
FontSize,
Foreground);
context.DrawText(formatted, new Point(offsetX, 0));
if (isName) {
var lineY = formatted.Baseline + 2;
offsetX += 4;
context.DrawText(formatted, new Point(offsetX, 0));
context.DrawLine(underlinePen, new Point(offsetX, lineY), new Point(offsetX + formatted.Width, lineY));
offsetX += formatted.Width;
offsetX += formatted.Width + 4;
} else {
context.DrawText(formatted, new Point(offsetX, 0));
offsetX += formatted.Width;
if (part.StartsWith(' ')) offsetX += 2;
if (part.EndsWith(' ')) offsetX += 4;
}
isName = !isName;