added check for null MacroDef

additional checks for checkoffs and logic support or NSP script Cautions with bullets
fixed pagelist processing issue when pagelist row has more than one token
support for NSP script Cautions
fixed problem where the END message was not printing for NSP (the Y location was negative – off the page)
This commit is contained in:
2011-12-07 14:04:53 +00:00
parent b48e39be12
commit f7cb594d76
5 changed files with 172 additions and 70 deletions

View File

@@ -96,8 +96,23 @@ namespace Volian.Print.Library
//float w = iFont.BaseFont.GetWidthPointKerned(Text.Replace("\u25CF","@"), (float)vefont.Size);
return w;
}
bool _ScriptCaution = false;
public bool ScriptCaution
{
get { return _ScriptCaution; }
set { _ScriptCaution = value; }
}
bool _SeparateBullet = false;
public bool SeparateBullet
{
get { return _SeparateBullet; }
set { _SeparateBullet = value; }
}
public vlnTab(PdfContentByte cb, vlnParagraph myparent, string origTab, string cleanTab, float xoffset, float yoffset, VE_Font vFont, bool doSectTab, string symblFontName)
{
ScriptCaution = (origTab.Contains("Caution") && vFont.Family == "VolianScript");
MyContentByte = cb;
MyParent = myparent;
YOffset = yoffset;
@@ -105,10 +120,20 @@ namespace Volian.Print.Library
MyFont = vFont;
float CCCs = GetTextWidth(MyFont, "CCCCCCCCCC", symblFontName);
float IIIs = GetTextWidth(MyFont, "iiiiiiiiii", symblFontName);
if (CCCs != IIIs)
if (ScriptCaution)
{
Text = origTab.Replace("Caution ", "\uF043\uF061\uF069\uF06E\uF06F\uF074\uF075\uF020\uF020");
Width = 90;
}
else if ((myparent.MyItemInfo.FormatStepData.TabData.IdentWidth ?? 0) > 0)
Width = (float)myparent.MyItemInfo.FormatStepData.TabData.IdentWidth;
else if (CCCs != IIIs)
Width = Text.Length * 6; //proportial font (7 chars * 6)
else
Width = GetTextWidth(MyFont, (Text != null ? Text : origTab), symblFontName);//MyFont.CharsToTwips * (Text != null ? Text.Length : origTab.Length);
if (myparent.MyItemInfo.FormatStepData.TabData.Bullet.Separate)
if (myparent.MyItemInfo.MyPrevious != null || myparent.MyItemInfo.NextItem != null)
SeparateBullet = true;
//if (MyParent.MyItemInfo.ItemID == 108)//120)
// Console.WriteLine("here");
if (origTab.Contains(@"{!"))
@@ -128,28 +153,52 @@ namespace Volian.Print.Library
Width = GetTextWidth(MyFont, (cleanTab != null ? cleanTab : origTab), symblFontName);//MyFont.CharsToTwips * (cleanTab != null ? cleanTab.Length : origTab.Length);
}
Rtf = GetRtf(origTab, vFont);
if (Rtf.Contains("Caution") && vFont.Family == "VolianScript")
Rtf = Rtf.Replace("\u0394", @"\f1\u916?\f0 "); // delta 0x0394
if (ScriptCaution)
{
Rtf = GetRtf("\u25CFCaution ", vFont);
Rtf = Rtf.Replace("\u25CF", @"\f1\fs20 \u9679?\f0\par\f0\fs64 "); // bullet 25CF // jsj- force bullet size (is different than tab text)
if (myparent.MyItemInfo.FormatStepData != null && !myparent.MyItemInfo.FormatStepData.AlwaysTab && myparent.MyItemInfo.MyPrevious != null)
Rtf = Rtf.Replace("Caution ", @"\u61472?\u61472?\u61472?\u61472?\u61472?\u61472?\u61472?\u61472?\u61472?");
else
{
if (myparent.MyItemInfo.FormatStepData != null && !myparent.MyItemInfo.FormatStepData.AlwaysTab && myparent.MyItemInfo.NextItem == null)
Rtf = Rtf.Replace(@"\u9679?", "");
Rtf = Rtf.Replace("Caution ", @"\u61507?\u61537?\u61557?\u61556?\u61545?\u61551?\u61550?\u61472?\u61472?");
}
}
else
{
if (SeparateBullet)
Rtf = Rtf.Replace("\u25CF", "");
else
Rtf = Rtf.Replace("\u25CF", @"\f1\u9679?\f0 "); // bullet 25CF // jsj- add space after \f0
//Rtf = Rtf.Replace("\u25CF", @"\f1\fs18\b0\i0 \u9679?\f0 "); // bullet 25CF // jsj- add space after \f0
if (myparent.MyItemInfo.FormatStepData != null && !myparent.MyItemInfo.FormatStepData.AlwaysTab && myparent.MyItemInfo.MyPrevious != null)
{
//if (scriptCaution)
// Rtf = Rtf.Replace("CAUTION ", @"\u61472?\u61472?\u61472?\u61472?\u61472?\u61472?\u61472?\u61472?\u61472?");
Rtf = Rtf.Replace("Caution:", " ");
Rtf = Rtf.Replace("Note:", " ");
Rtf = Rtf.Replace("CAUTION:", " ");
Rtf = Rtf.Replace("NOTE:", " ");
Rtf = Rtf.Replace("Caution", " ");
Rtf = Rtf.Replace("Note", " ");
Rtf = Rtf.Replace("CAUTION", " ");
Rtf = Rtf.Replace("NOTE", " ");
}
}
if (ScriptCaution && Rtf.Contains("Caution"))
{
// NSP script caution
iTextSharp.text.Font myfont = pdf.GetFont(vFont.Family, 24, 0, iTextSharp.text.Color.BLACK);
if (myfont.BaseFont.CharExists(0x43)) // Capital 'C' exists as text
Rtf = Rtf; // no change necessary
else // Capital 'C' exists as Symbol
//Rtf = Rtf.Replace("Caution", @"\u61507?\u61537?\u61557?\u61556?\u61545?\u61551?\u61550?");
Rtf = Rtf.Replace("Caution", @"\u61507?a\u61557?t\u61545?o\u61550?");
}
Rtf = Rtf.Replace("\u25CF", @"\f1\u9679?\f0 "); // bullet 25CF // jsj- add space after \f0
Rtf = Rtf.Replace("\u0394", @"\f1\u916?\f0 "); // delta 0x0394
if (myparent.MyItemInfo.FormatStepData != null && !myparent.MyItemInfo.FormatStepData.AlwaysTab && myparent.MyItemInfo.MyPrevious != null)
{
Rtf = Rtf.Replace("Caution:", " ");
Rtf = Rtf.Replace("Note:", " ");
Rtf = Rtf.Replace("CAUTION:", " ");
Rtf = Rtf.Replace("NOTE:", " ");
Rtf = Rtf.Replace("Caution", " ");
Rtf = Rtf.Replace("Note", " ");
Rtf = Rtf.Replace("CAUTION", " ");
Rtf = Rtf.Replace("NOTE", " ");
iTextSharp.text.Font myfont = pdf.GetFont(vFont.Family, 28, 0, iTextSharp.text.Color.BLACK);
if (!myfont.BaseFont.CharExists(0x43)) // Capital 'C' exists as text
{
//VE_Font vf = new VE_Font("VolianScript", 28, E_Style.Italics, 12);
// Capital 'C' exists as Symbol
Rtf = Rtf.Replace("Caution ", @"\u61507?\u61537?\u61557?\u61556?\u61545?\u61551?\u61550?\u61472?\u61472?");
}
}