From a038fe06e929bc59a56534affe1d90f0352b293a Mon Sep 17 00:00:00 2001 From: Kathy Date: Mon, 22 Jun 2015 14:42:46 +0000 Subject: [PATCH] B2015- 076: underlining overwrites text below (occurred on compressed steps with larger font) --- PROMS/Volian.Print.Library/Rtf2iTextSharp.cs | 18 +++++++++++++----- PROMS/Volian.Print.Library/vlnParagraph.cs | 5 +---- PROMS/Volian.Print.Library/vlnPrintObject.cs | 10 +++++++++- 3 files changed, 23 insertions(+), 10 deletions(-) diff --git a/PROMS/Volian.Print.Library/Rtf2iTextSharp.cs b/PROMS/Volian.Print.Library/Rtf2iTextSharp.cs index 614360ec..f1a752dc 100644 --- a/PROMS/Volian.Print.Library/Rtf2iTextSharp.cs +++ b/PROMS/Volian.Print.Library/Rtf2iTextSharp.cs @@ -227,12 +227,20 @@ namespace Volian.Print.Library if (visualText.Format.IsUnderline) if (visualText.Format.SuperScript < 0) ;// Don't Underline Subscripts - //if (PrintOverride.CompressSub) - // chk.SetUnderline(font.Color, 0, 0.0666F, 0, -.425F, PdfContentByte.LINE_CAP_ROUND); // Relative Based upon font size - //else - // chk.SetUnderline(font.Color, 0, 0.05F, 0, -.381F, PdfContentByte.LINE_CAP_ROUND); // Relative Based upon font size + //if (PrintOverride.CompressSub) + // chk.SetUnderline(font.Color, 0, 0.0666F, 0, -.425F, PdfContentByte.LINE_CAP_ROUND); // Relative Based upon font size + //else + // chk.SetUnderline(font.Color, 0, 0.05F, 0, -.381F, PdfContentByte.LINE_CAP_ROUND); // Relative Based upon font size else - chk.SetUnderline(font.Color, 0, 0.05F, 0, -.131F, PdfContentByte.LINE_CAP_ROUND); // Relative Based upon font size + { + // If on a compressed printed step (Leading < 12) and a larger underlined font, then set the underlining + // a little less far down the page. Without this, the underline was touching the 2nd line of text, if it existed. + // Any plant that had compressed steps with the font size/underline would have this problem. An example + // was Braidwood FSG-6, high level steps. + float yoffund = (_MyParagraph.Leading < 12 && font.Size >= 12) ? -0.06F : -0.131F; + chk.SetUnderline(font.Color, 0, 0.05F, 0, yoffund, PdfContentByte.LINE_CAP_ROUND); // Relative Based upon font size + } + if (visualText.Format.SuperScript > 0) { if (PrintOverride.CompressPropSubSup) diff --git a/PROMS/Volian.Print.Library/vlnParagraph.cs b/PROMS/Volian.Print.Library/vlnParagraph.cs index 50f5eaac..e480691b 100644 --- a/PROMS/Volian.Print.Library/vlnParagraph.cs +++ b/PROMS/Volian.Print.Library/vlnParagraph.cs @@ -560,6 +560,7 @@ namespace Volian.Print.Library if (doprint) { int profileDepth = ProfileTimer.Push(">>>> vlnParagraph.DrawText"); + IsCompressed = (MyPageHelper.YMultiplier != 1 && MyItemInfo != null && MyItemInfo.FormatStepData != null && MyItemInfo.FormatStepData.Font.Size >= 12 && (MyItemInfo.FormatStepData.Font.Style & E_Style.Underline) != 0); retval = DrawText(cb, ref yPageStart, yTopMargin, yBottomMargin, ref yLocation); // Wolf Creek Training format puts a separator line after printing the section number/title if (MyItemInfo.IsSection && MyItemInfo.ActiveFormat.PlantFormat.FormatData.PrintData.WCNTraining) @@ -861,7 +862,6 @@ namespace Volian.Print.Library private float DrawText(PdfContentByte cb, ref float yPageStart, float yTopMargin, float yBottomMargin, ref float yLocation) { - // KBR (6/17/15): Fix for underline location in compressed steps: PrintOverride.StepCompress = false; if(DebugText.IsOpen)DebugText.WriteLine("{0},'{1}','{2}','<>'", MyItemInfo.ItemID, MyItemInfo.DBSequence, FormattedText); //Console.WriteLine("{0},{1},'{2}','<>'", MyItemInfo.ItemID, MyItemInfo.DBSequence, IParagraph.Content); float retval = yLocation; @@ -954,10 +954,7 @@ namespace Volian.Print.Library //if (MyItemInfo.InList(39048)) Console.WriteLine("Here"); } MyPageHelper.BottomContent = yLocation - (Height * MyPageHelper.YMultiplier); - // KBR (6/17/15): Fix for underline location in compressed steps: - // KBR (6/17/15): if (MyPageHelper.YMultiplier != 1) PrintOverride.StepCompress = true; retval = Rtf2Pdf.TextAt(cb, IParagraph, XOffset, yLocation, Width, 100, DebugInfo + string.Format(",YLines = {0}", YSize / SixLinesPerInch), yBottomMargin); - // KBR (6/17/15): PrintOverride.StepCompress = true; ProfileTimer.Pop(profileDepth); if (retval == 0) // problem occurred - paragraph was not able to be printed on page { // pagination logic needs to be fixed. diff --git a/PROMS/Volian.Print.Library/vlnPrintObject.cs b/PROMS/Volian.Print.Library/vlnPrintObject.cs index ae4a2a42..d6729e7c 100644 --- a/PROMS/Volian.Print.Library/vlnPrintObject.cs +++ b/PROMS/Volian.Print.Library/vlnPrintObject.cs @@ -72,6 +72,12 @@ namespace Volian.Print.Library get { return _HasIndent; } set { _HasIndent = value; } } + private bool _IsCompressed = false; + public bool IsCompressed + { + get { return _IsCompressed; } + set { _IsCompressed = value; } + } private string _ImageText; // ro definition, value part of #Link in case of image/figure public string ImageText { @@ -101,7 +107,9 @@ namespace Volian.Print.Library { get { - if (_IParagraph == null) + // If the paragraph iscompressed, it may have been created as not compressed since compression + // is not set when paragraph is initially created, it is set during pagination tests. + if (_IParagraph == null || IsCompressed) { int profileDepth = ProfileTimer.Push(">>>> VlnPrintObject.IParagraph"); string myRtf = Rtf;