Fixed logic for displaying (on the screen) a Caution tab that uses a larger point size then the caution text (NSP)

This commit is contained in:
John Jenko 2013-05-06 17:23:13 +00:00
parent a303303074
commit 060baa1cf2

View File

@ -111,6 +111,7 @@ namespace Volian.Print.Library
}
public vlnTab(PdfContentByte cb, vlnParagraph myparent, string origTab, string cleanTab, float xoffset, float yoffset, VE_Font vFont, bool doSectTab, string symblFontName, bool removedUnderline)
{
bool alignAsIfBulleted = false;
ScriptCaution = (origTab.Contains("Caution") && vFont.Family == "VolianScript");
MyContentByte = cb;
MyParent = myparent;
@ -140,9 +141,18 @@ namespace Volian.Print.Library
}
else
Width = GetTextWidth(MyFont, (Text != null ? Text : origTab), symblFontName); //MyFont.CharsToTwips * (Text != null ? Text.Length : origTab.Length);
// Pairie Island (NSP) Caution and Note tabs use a larger font
// When using a bullet, we need to use the font size of the Caution/Note text instead of the tab.
// To do this we set the TabData.Bullet.Separate to true (currently - 4/26/2013 - only NSP uses this).
// Because of the different font sizes, when the Caution/Note did have have a bullet, the positioning
// was off by the lenght of IdentB (the bullet string), thus the "alignAsIfBulleted" bool
if ((myparent.MyItemInfo.FormatStepData != null) && myparent.MyItemInfo.FormatStepData.TabData.Bullet.Separate)
if (myparent.MyItemInfo.MyPrevious != null || myparent.MyItemInfo.NextItem != null)
SeparateBullet = true;
else
alignAsIfBulleted = true;
if (origTab.Contains(@"{!"))
{
int mindx = origTab.IndexOf(@"{!");
@ -260,13 +270,21 @@ namespace Volian.Print.Library
}
else
{
//if (MyFont.Family == "Arial" && MyFont.Size == 14)
//{
// System.Drawing.Font font = new System.Drawing.Font("Arial", 14);
// iTextSharp.text.Font iFont = Volian.Svg.Library.VolianPdf.GetFont(font);
// float w = iFont.BaseFont.GetWidthPointKerned(Text, 14);
// Width = w;
//}
// if using a proportional font and the tab font/size is different than the text font/size
if (CCCs != IIIs &&
(MyFont.Family != myparent.MyItemInfo.FormatStepData.Font.Family ||
MyFont.Size != myparent.MyItemInfo.FormatStepData.Font.Size))
{
// This is needed for Prairie Island (NSP) Caution/Note tabs to consistantly position
// them at the same horizontal (column) position on the page
string txt = Text;
if (alignAsIfBulleted)
txt += myparent.MyItemInfo.ActiveFormat.PlantFormat.FormatData.SectData.StepSectionData.IdentB;
System.Drawing.Font font = new System.Drawing.Font(MyFont.Family,(float)MyFont.Size);
iTextSharp.text.Font iFont = Volian.Svg.Library.VolianPdf.GetFont(font);
float w = iFont.BaseFont.GetWidthPointKerned(txt, (float)MyFont.Size);
Width = w;
}
XOffset = xoffset - Width;
}