C2017-036 Call method that finds a proportional font that supports the symbol characters we use.

This commit is contained in:
2017-11-13 17:38:22 +00:00
parent a2c11290a7
commit 203baaf699
12 changed files with 101 additions and 69 deletions

View File

@@ -1048,14 +1048,15 @@ namespace Volian.Controls.Library
get { return _CircleYOffset; }
set { _CircleYOffset = value; if (_MyStepPanel != null) _MyStepPanel.Refresh(); }
}
private Font _CircleFont = new Font("Arial Unicode MS", 23);
[Category("Circle")]
[DisplayName("Circle Font")]
public Font CircleFont
{
get { return _CircleFont; }
set { _CircleFont = value; if(_MyStepPanel != null) _MyStepPanel.Refresh(); }
}
// Appears to not be used - JSJ - 11-13-2017
//private Font _CircleFont = new Font("Arial Unicode MS", 23);
//[Category("Circle")]
//[DisplayName("Circle Font")]
//public Font CircleFont
//{
// get { return _CircleFont; }
// set { _CircleFont = value; if(_MyStepPanel != null) _MyStepPanel.Refresh(); }
//}
private Color _CircleColor = Color.Black;
[Category("Circle")]
[DisplayName("Circle Color")]

View File

@@ -281,8 +281,7 @@ namespace Volian.Controls.Library
using (StepRTB srtb = new StepRTB())
{
if (srtb.FontIsFixed(font)) MySymbolFontName = "FreeMono"; // FreeMono is now used for the edit screen only. VESymbFix and Consolas are used for printing
//else MySymbolFontName = Volian.Base.Library.vlnFont.ProportionalSymbolFont; // "FreeSerif";
else MySymbolFontName = "Arial Unicode MS";
else MySymbolFontName = Volian.Base.Library.vlnFont.ProportionalSymbolFont; // C2017-036 get best available proportional font for symbols
}
}
else
@@ -1250,8 +1249,7 @@ namespace Volian.Controls.Library
}
selectedRtfSB.Append(@"{\rtf1\ansi\ansicpg1252\deff0\deflang1033{\fonttbl{\f0\fnil\fcharset2 " + myFont.FontFamily.Name + @";}"); //}\f0\fs" + this.Font.SizeInPoints * 2 + @" " + myDisplayTextElement.Text + @"}}";
if (!isFixed)
//selectedRtfSB.Append(@"{\f1\fnil\fcharset0 " + Volian.Base.Library.vlnFont.ProportionalSymbolFont + @";}}{\colortbl ;\red255\green0\blue0;}");
selectedRtfSB.Append(@"{\f1\fnil\fcharset0 Arial Unicode MS;}}{\colortbl ;\red255\green0\blue0;}");
selectedRtfSB.Append(@"{\f1\fnil\fcharset0 " + Volian.Base.Library.vlnFont.ProportionalSymbolFont + @";}}{\colortbl ;\red255\green0\blue0;}"); // C2017-036 get best available proportional font for symbols
else
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");
@@ -1330,8 +1328,7 @@ namespace Volian.Controls.Library
StringBuilder sb = new StringBuilder();
sb.Append(@"{\fonttbl{\f0\fnil\fcharset2 " + this.Font.FontFamily.Name + @";}");
if (!FontIsFixed(this.Font))
//sb.Append(@"{\f1\fnil\fcharset0 " + Volian.Base.Library.vlnFont.ProportionalSymbolFont + @";}}");
sb.Append(@"{\f1\fnil\fcharset0 Arial Unicode MS;}}");
sb.Append(@"{\f1\fnil\fcharset0 " + Volian.Base.Library.vlnFont.ProportionalSymbolFont + @";}}"); // C2017-036 get best available proportional font for symbols
else
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();

View File

@@ -869,9 +869,10 @@ namespace Volian.Controls.Library
get { return _ReadingXml; }
}
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]+[^ ]* )(" + Volian.Base.Library.vlnFont.ProportionalSymbolFont + @")(;})"); // C2017-036 get best available proportional font for symbols
// B2017-173 VESymFix font was being replaced by the table's default font, causing empty squares for the symbols (pre FreeMono font) in tables
private static Regex _ReplaceTextFont = new Regex(@"({\\f[0-9]+[^ ]* )(?((?!FreeMono)(?!Arial Unicode MS)(?!VESymbFix))([^;]*)|(!!!!))(;})"); // FreeMono is now used for the edit screen only. VESymbFix and Consolas are used for printing
//C2017-036 Added FreeSerif which may be used if Arial Unicode MS is not available
private static Regex _ReplaceTextFont = new Regex(@"({\\f[0-9]+[^ ]* )(?((?!FreeMono)(?!FreeSerif)(?!Arial Unicode MS)(?!VESymbFix))([^;]*)|(!!!!))(;})"); // FreeMono is now used for the edit screen only. VESymbFix and Consolas are used for printing
private bool FontIsFixed(Font myFont)
{
Graphics grph = Graphics.FromHwnd(this.Handle);
@@ -899,7 +900,7 @@ namespace Volian.Controls.Library
FontFamily ff = StepRTB.MyFontFamily;
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");
if (StepRTB.MySymbolFontName != "Arial Unicode MS")
if (StepRTB.MySymbolFontName != Volian.Base.Library.vlnFont.ProportionalSymbolFont) // C2017-036 get best available proportional font for symbols
str = _ReplaceArialUnicodeMS.Replace(str, "$1" + StepRTB.MySymbolFontName + "$3");
str = _ReplaceTextFont.Replace(str, "$1" + ff.Name + "$4");
}
@@ -909,7 +910,7 @@ namespace Volian.Controls.Library
if (FontIsFixed(vefont.WindowsFont))
str = _ReplaceArialUnicodeMS.Replace(str, "$1" + "FreeMono" + "$3"); // FreeMono is now used for the edit screen only. VESymbFix and Consolas are used for printing
else
str = _ReplaceVESymbFix.Replace(str, "$1" + "Arial Unicode MS" + "$3");
str = _ReplaceVESymbFix.Replace(str, "$1" + Volian.Base.Library.vlnFont.ProportionalSymbolFont + "$3"); // C2017-036 get best available proportional font for symbols
str = _ReplaceTextFont.Replace(str, "$1" + ff.Name + "$4");
}
// To prevent scroll bars from being flashed on/off