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

@@ -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