From fc34e050ef87ecf7886a809021565a0edc7ea67e Mon Sep 17 00:00:00 2001 From: John Date: Mon, 18 Jun 2012 20:24:45 +0000 Subject: [PATCH] if PageItem font CPI is null, then default to 12 CPI Commented out script caution logic (used in NSP for 16-bit VE-PROMS) --- .../Volian.Print.Library/VlnSvgPageHelper.cs | 4 +- PROMS/Volian.Print.Library/vlnTab.cs | 37 ++++++++++--------- 2 files changed, 22 insertions(+), 19 deletions(-) diff --git a/PROMS/Volian.Print.Library/VlnSvgPageHelper.cs b/PROMS/Volian.Print.Library/VlnSvgPageHelper.cs index b126b3ea..72321870 100644 --- a/PROMS/Volian.Print.Library/VlnSvgPageHelper.cs +++ b/PROMS/Volian.Print.Library/VlnSvgPageHelper.cs @@ -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; diff --git a/PROMS/Volian.Print.Library/vlnTab.cs b/PROMS/Volian.Print.Library/vlnTab.cs index 66af4ab6..faef9966 100644 --- a/PROMS/Volian.Print.Library/vlnTab.cs +++ b/PROMS/Volian.Print.Library/vlnTab.cs @@ -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