if PageItem font CPI is null, then default to 12 CPI

Commented out script caution logic (used in NSP for 16-bit VE-PROMS)
This commit is contained in:
John Jenko 2012-06-18 20:24:45 +00:00
parent b7270782e6
commit fc34e050ef
2 changed files with 22 additions and 19 deletions

View File

@ -997,7 +997,9 @@ namespace Volian.Print.Library
// Take the difference between the width in Points of a character at 12CPI and a character
// at the defined font's CPI. Multiply that times the length of title and divide by two
// to find the half-way point.
colAdj16bit = (1 + text.Length) * ((72 / (float)pageItem.Font.CPI) - (72 / 12)) / 2;
// if the PageItem's font CPI is null, then default to 12 CPI
colAdj16bit = (1 + text.Length) * ((72 / (float)(pageItem.Font.CPI ?? 12)) - (72 / 12)) / 2;
}
}
svgText.Font = pageItem.Font.WindowsFont;

View File

@ -112,7 +112,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)
{
ScriptCaution = (origTab.Contains("Caution") && vFont.Family == "VolianScript");
//ScriptCaution = (origTab.Contains("Caution") && vFont.Family == "VolianScript");
MyContentByte = cb;
MyParent = myparent;
YOffset = yoffset;
@ -121,12 +121,13 @@ namespace Volian.Print.Library
float CCCs = GetTextWidth(MyFont, "CCCCCCCCCC", symblFontName);
float IIIs = GetTextWidth(MyFont, "iiiiiiiiii", symblFontName);
string origTab1 = origTab;
if (ScriptCaution)
{
Text = origTab.Replace("Caution ", "\uF043\uF061\uF069\uF06E\uF06F\uF074\uF075\uF020\uF020");
Width = 90;
}
else if ((myparent.MyItemInfo.FormatStepData != null) && (myparent.MyItemInfo.FormatStepData.TabData.IdentWidth ?? 0) > 0)
//if (ScriptCaution)
//{
// Text = origTab.Replace("Caution ", "\uF043\uF061\uF069\uF06E\uF06F\uF074\uF075\uF020\uF020");
// Width = 90;
//}
//else if ((myparent.MyItemInfo.FormatStepData != null) && (myparent.MyItemInfo.FormatStepData.TabData.IdentWidth ?? 0) > 0)
if ((myparent.MyItemInfo.FormatStepData != null) && (myparent.MyItemInfo.FormatStepData.TabData.IdentWidth ?? 0) > 0)
Width = (float)myparent.MyItemInfo.FormatStepData.TabData.IdentWidth;
else if (CCCs != IIIs)
{
@ -227,18 +228,18 @@ namespace Volian.Print.Library
Rtf = Rtf.Replace("NOTE", " ");
}
}
if (ScriptCaution && Rtf.Contains("Caution"))
{
// NSP script caution
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?");
}
//if (ScriptCaution && Rtf.Contains("Caution"))
//{
// // NSP script caution
// 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?");
// }
}
//}
// do positioning based on whether format has locations for section 'header'. If it's not centered, treat