Use the FreeMono font for symbols in the edit window

This commit is contained in:
John Jenko 2015-07-23 14:39:40 +00:00
parent d82a57f751
commit 957499d93c
2 changed files with 7 additions and 7 deletions

View File

@ -226,7 +226,7 @@ namespace Volian.Controls.Library
font = new Font(value, 10, FontStyle.Italic); font = new Font(value, 10, FontStyle.Italic);
using (StepRTB srtb = new StepRTB()) using (StepRTB srtb = new StepRTB())
{ {
if (srtb.FontIsFixed(font)) MySymbolFontName = "VESymbFix"; if (srtb.FontIsFixed(font)) MySymbolFontName = "FreeMono"; // FreeMono is now used for the edit screen only. VESymbFix and Consolas are used for printing
else MySymbolFontName = "Arial Unicode MS"; else MySymbolFontName = "Arial Unicode MS";
} }
} }
@ -999,7 +999,7 @@ namespace Volian.Controls.Library
if (!isFixed) if (!isFixed)
selectedRtfSB.Append(@"{\f1\fnil\fcharset0 Arial Unicode MS;}}{\colortbl ;\red255\green0\blue0;}"); selectedRtfSB.Append(@"{\f1\fnil\fcharset0 Arial Unicode MS;}}{\colortbl ;\red255\green0\blue0;}");
else else
selectedRtfSB.Append(@"{\f1\fnil\fcharset0 VESymbFix;}}{\colortbl ;\red255\green0\blue0;}"); selectedRtfSB.Append(@"{\f1\fnil\fcharset0 FreeMono;}}{\colortbl ;\red255\green0\blue0;}"); // FreeMono is now used for the edit screen only. VESymbFix and Consolas are used for printing
selectedRtfSB.Append("\r\n"); selectedRtfSB.Append("\r\n");
// use styles to construct rtf commands to insert into next line (where \b, etc is) // use styles to construct rtf commands to insert into next line (where \b, etc is)
selectedRtfSB.Append(@"\viewkind4\uc1\pard\sl-240\slmult0" + sbbeg.ToString() + @"\fs" + Convert.ToInt32(myFont.SizeInPoints * 2).ToString() + @" "); // \f0\fs" + this.Font.SizeInPoints * 2 + @" " + myDisplayTextElement.Text + @"}"; selectedRtfSB.Append(@"\viewkind4\uc1\pard\sl-240\slmult0" + sbbeg.ToString() + @"\fs" + Convert.ToInt32(myFont.SizeInPoints * 2).ToString() + @" "); // \f0\fs" + this.Font.SizeInPoints * 2 + @" " + myDisplayTextElement.Text + @"}";
@ -1076,7 +1076,7 @@ namespace Volian.Controls.Library
if (!FontIsFixed(this.Font)) if (!FontIsFixed(this.Font))
sb.Append(@"{\f1\fnil\fcharset0 Arial Unicode MS;}}"); sb.Append(@"{\f1\fnil\fcharset0 Arial Unicode MS;}}");
else else
sb.Append(@"{\f1\fnil\fcharset0 VESymbFix;}}"); sb.Append(@"{\f1\fnil\fcharset0 FreeMono;}}"); // FreeMono is now used for the edit screen only. VESymbFix and Consolas are used for printing
return sb.ToString(); return sb.ToString();
} }
} }

View File

@ -844,9 +844,9 @@ namespace Volian.Controls.Library
{ {
get { return _ReadingXml; } get { return _ReadingXml; }
} }
private static Regex _ReplaceVESymbFix = new Regex(@"({\\f[0-9]+[^ ]* )(VESymbFix)(;})"); private static Regex _ReplaceVESymbFix = new Regex(@"({\\f[0-9]+[^ ]* )(FreeMono)(;})"); // FreeMono is now used for the edit screen only. VESymbFix and Consolas are used for printing
private static Regex _ReplaceArialUnicodeMS = new Regex(@"({\\f[0-9]+[^ ]* )(Arial Unicode MS)(;})"); private static Regex _ReplaceArialUnicodeMS = new Regex(@"({\\f[0-9]+[^ ]* )(Arial Unicode MS)(;})");
private static Regex _ReplaceTextFont = new Regex(@"({\\f[0-9]+[^ ]* )(?((?!VESymbFix)(?!Arial Unicode MS))([^;]*)|(!!!!))(;})"); private static Regex _ReplaceTextFont = new Regex(@"({\\f[0-9]+[^ ]* )(?((?!FreeMono)(?!Arial Unicode MS))([^;]*)|(!!!!))(;})"); // FreeMono is now used for the edit screen only. VESymbFix and Consolas are used for printing
private bool FontIsFixed(Font myFont) private bool FontIsFixed(Font myFont)
{ {
Graphics grph = Graphics.FromHwnd(this.Handle); Graphics grph = Graphics.FromHwnd(this.Handle);
@ -872,7 +872,7 @@ namespace Volian.Controls.Library
if (StepRTB.MyFontFamily != null) if (StepRTB.MyFontFamily != null)
{ {
FontFamily ff = StepRTB.MyFontFamily; FontFamily ff = StepRTB.MyFontFamily;
if (StepRTB.MySymbolFontName != "VESymbFix") if (StepRTB.MySymbolFontName != "FreeMono") // FreeMono is now used for the edit screen only. VESymbFix and Consolas are used for printing
str = _ReplaceVESymbFix.Replace(str, "$1" + StepRTB.MySymbolFontName + "$3"); str = _ReplaceVESymbFix.Replace(str, "$1" + StepRTB.MySymbolFontName + "$3");
if (StepRTB.MySymbolFontName != "Arial Unicode MS") if (StepRTB.MySymbolFontName != "Arial Unicode MS")
str = _ReplaceArialUnicodeMS.Replace(str, "$1" + StepRTB.MySymbolFontName + "$3"); str = _ReplaceArialUnicodeMS.Replace(str, "$1" + StepRTB.MySymbolFontName + "$3");
@ -882,7 +882,7 @@ namespace Volian.Controls.Library
{ {
FontFamily ff = vefont.WindowsFont.FontFamily; FontFamily ff = vefont.WindowsFont.FontFamily;
if (FontIsFixed(vefont.WindowsFont)) if (FontIsFixed(vefont.WindowsFont))
str = _ReplaceArialUnicodeMS.Replace(str, "$1" + "VESymbFix" + "$3"); str = _ReplaceArialUnicodeMS.Replace(str, "$1" + "FreeMono" + "$3"); // FreeMono is now used for the edit screen only. VESymbFix and Consolas are used for printing
else else
str = _ReplaceVESymbFix.Replace(str, "$1" + "Arial Unicode MS" + "$3"); str = _ReplaceVESymbFix.Replace(str, "$1" + "Arial Unicode MS" + "$3");
str = _ReplaceTextFont.Replace(str, "$1" + ff.Name + "$4"); str = _ReplaceTextFont.Replace(str, "$1" + ff.Name + "$4");