Added the command line parater to specify the PromsFonts to speed-up printing.

This commit is contained in:
Rich 2015-03-06 14:16:37 +00:00
parent 5dc41a738b
commit 98736263e0

View File

@ -62,26 +62,46 @@ namespace Volian.Svg.Library
}
public static void RegisterFont(string fontName)
{
int profileDepth = ProfileTimer.Push(">>>> RegisterFont");
int profileDepth = ProfileTimer.Push(string.Format(">>>> RegisterFont {0}",fontName));
if (!iTextSharp.text.FontFactory.IsRegistered(fontName))
{
int profileDepth1 = ProfileTimer.Push(">>>> RegisterDirectory");
iTextSharp.text.FontFactory.RegisterDirectory(FontFind.FontDir);
string fntdir = Volian.Base.Library.VlnSettings.GetCommand("PromsFonts", FontFind.FontDir);
int profileDepth1 = ProfileTimer.Push(">>>> RegisterDirectory " + fntdir);
iTextSharp.text.FontFactory.RegisterDirectory(fntdir);
ProfileTimer.Pop(profileDepth1);
if (!iTextSharp.text.FontFactory.IsRegistered(fontName))
{
_MyLog.WarnFormat("Problem with Font {0} in {1}", fontName, FontFind.FontDir);
iTextSharp.text.FontFactory.RegisterDirectory(FontFind.FontDir);
int profileDepth2 = ProfileTimer.Push(">>>> RegisterDirectories");
iTextSharp.text.FontFactory.RegisterDirectories();
ProfileTimer.Pop(profileDepth2);
if (!iTextSharp.text.FontFactory.IsRegistered(fontName))
_MyLog.WarnFormat("Problem with Font {0} in {1}", fontName, fntdir);
if (fntdir != FontFind.FontDir)
{
_MyLog.WarnFormat("Font {0} could not be found!", fontName);
int profileDepth2 = ProfileTimer.Push(">>>> RegisterDirectory " + FontFind.FontDir);
iTextSharp.text.FontFactory.RegisterDirectory(FontFind.FontDir);
ProfileTimer.Pop(profileDepth2);
if (!iTextSharp.text.FontFactory.IsRegistered(fontName))
{
_MyLog.WarnFormat("Problem with Font {0} in {1}", fontName, FontFind.FontDir);
int profileDepth3 = ProfileTimer.Push(">>>> RegisterDirectories");
iTextSharp.text.FontFactory.RegisterDirectories();
ProfileTimer.Pop(profileDepth3);
}
}
else
{
iTextSharp.text.Font fnt = iTextSharp.text.FontFactory.GetFont(fontName, 10);
int profileDepth4 = ProfileTimer.Push(">>>> RegisterDirectories");
iTextSharp.text.FontFactory.RegisterDirectories();
ProfileTimer.Pop(profileDepth4);
}
}
if (!iTextSharp.text.FontFactory.IsRegistered(fontName))
{
_MyLog.WarnFormat("Font {0} could not be found!", fontName);
}
else
{
iTextSharp.text.Font fnt = iTextSharp.text.FontFactory.GetFont(fontName, 10);
if (fnt.BaseFont == null)
{
_MyLog.WarnFormat("Font {0} is not installed properly!", fontName);
}
}
}