B2019-174 Created static method to register the font fonder so that it can be called at the start of printing.
B2019-174 Register the font folder with iTechSharp so that the symbol fonts can be found when generating the Auto Table Of Contents
This commit is contained in:
parent
bfba372747
commit
7b57386758
@ -35,28 +35,35 @@ namespace Volian.Base.Library
|
||||
}
|
||||
}
|
||||
}
|
||||
// B2019-174 created RegisterFontFolder so that we call at start of print() in PromsPrinter.cs
|
||||
// this allows symbol characters to appear on the Auto Table Of Contents page
|
||||
public static void RegisterFontFolder()
|
||||
{
|
||||
if (_PromsFontDir == null || _PromsFontDir =="")//B2019-099 Consistent Font Retrieve
|
||||
{
|
||||
_PromsFontDir = Volian.Base.Library.VlnSettings.GetCommand("PromsFonts", "");
|
||||
if (_PromsFontDir == "")
|
||||
_PromsFontDir = FontFind.FontDir;
|
||||
else
|
||||
{
|
||||
DirectoryInfo di = new DirectoryInfo(_PromsFontDir);
|
||||
if (!di.Exists)
|
||||
_PromsFontDir = FontFind.FontDir;
|
||||
else
|
||||
_MyLog.WarnFormat("PROMS Font Folder = {0}", _PromsFontDir); // C2019-028 Add info in the error log
|
||||
}
|
||||
}
|
||||
int profileDepth1 = ProfileTimer.Push(">>>> RegisterDirectory " + _PromsFontDir);
|
||||
//_MyLog.DebugFormat("Register this Font Folder = {0}", _PromsFontDir); // debug
|
||||
iTextSharp.text.FontFactory.RegisterDirectory(_PromsFontDir);
|
||||
ProfileTimer.Pop(profileDepth1);
|
||||
}
|
||||
public static void RegisterFontByFontFolders(string fontName)
|
||||
{
|
||||
int profileDepth = ProfileTimer.Push(string.Format(">>>> RegisterFont {0}", fontName));
|
||||
if (!iTextSharp.text.FontFactory.IsRegistered(fontName))
|
||||
{
|
||||
if (_PromsFontDir == null)//B2019-099 Consistent Font Retrieve
|
||||
{
|
||||
_PromsFontDir = Volian.Base.Library.VlnSettings.GetCommand("PromsFonts", "");
|
||||
if (_PromsFontDir == "")
|
||||
_PromsFontDir = FontFind.FontDir;
|
||||
else
|
||||
{
|
||||
DirectoryInfo di = new DirectoryInfo(_PromsFontDir);
|
||||
if (!di.Exists)
|
||||
_PromsFontDir = FontFind.FontDir;
|
||||
else
|
||||
_MyLog.WarnFormat("PROMS Font Folder = {0}", _PromsFontDir); // C2019-028 Add info in the error log
|
||||
}
|
||||
}
|
||||
int profileDepth1 = ProfileTimer.Push(">>>> RegisterDirectory " + _PromsFontDir);
|
||||
iTextSharp.text.FontFactory.RegisterDirectory(_PromsFontDir);
|
||||
ProfileTimer.Pop(profileDepth1);
|
||||
RegisterFontFolder();
|
||||
if (!iTextSharp.text.FontFactory.IsRegistered(fontName))
|
||||
{
|
||||
//B2019-099 Consistent Font Retrieve
|
||||
@ -64,6 +71,7 @@ namespace Volian.Base.Library
|
||||
if (_PromsFontDir != FontFind.FontDir)
|
||||
{
|
||||
int profileDepth2 = ProfileTimer.Push(">>>> RegisterDirectory " + FontFind.FontDir);
|
||||
//_MyLog.DebugFormat("Register this Font Folder = {0}", FontFind.FontDir); // debug
|
||||
iTextSharp.text.FontFactory.RegisterDirectory(FontFind.FontDir);
|
||||
ProfileTimer.Pop(profileDepth2);
|
||||
if (!iTextSharp.text.FontFactory.IsRegistered(fontName))
|
||||
@ -72,11 +80,16 @@ namespace Volian.Base.Library
|
||||
int profileDepth3 = ProfileTimer.Push(">>>> RegisterDirectories");
|
||||
iTextSharp.text.FontFactory.RegisterDirectories();
|
||||
ProfileTimer.Pop(profileDepth3);
|
||||
}
|
||||
}
|
||||
//else
|
||||
//{
|
||||
// _MyLog.DebugFormat("Registered Font {0} in {1}", fontName, FontFind.FontDir); // debug
|
||||
//}
|
||||
}
|
||||
else
|
||||
{
|
||||
int profileDepth4 = ProfileTimer.Push(">>>> RegisterDirectories");
|
||||
//_MyLog.DebugFormat("RegistererDirectories {0}", FontFind.FontDir); // debug
|
||||
iTextSharp.text.FontFactory.RegisterDirectories();
|
||||
ProfileTimer.Pop(profileDepth4);
|
||||
}
|
||||
|
@ -684,7 +684,7 @@ namespace Volian.Print.Library
|
||||
|
||||
if (_MyFoldoutSection != null) _MyFoldoutSection.Clear();
|
||||
else _MyFoldoutSection = new List<SectionInfo>();
|
||||
|
||||
VlnItextFont.RegisterFontFolder(); //B2019-174 register the font folder so that symbols will display on auto TOC
|
||||
if (myProcedure.Sections != null)
|
||||
{
|
||||
int cnt = 0;
|
||||
|
Loading…
x
Reference in New Issue
Block a user