From 2cbf0d251574c534b6fcfce56a21f47e6290afca Mon Sep 17 00:00:00 2001 From: John Date: Fri, 13 Oct 2017 16:54:13 +0000 Subject: [PATCH] B2017-233, B2017-234 (rework of B2017-105 which caused issue) need to reset the MultipliedLeading if smallest font size (in table cell) is less than 10 and recalculate MulipliedLeading if biggest font size is greater than 12 --- PROMS/Volian.Print.Library/Grid2Pdf.cs | 31 ++++++++++++++++++++++++-- 1 file changed, 29 insertions(+), 2 deletions(-) diff --git a/PROMS/Volian.Print.Library/Grid2Pdf.cs b/PROMS/Volian.Print.Library/Grid2Pdf.cs index 10f0124e..bf3d3c76 100644 --- a/PROMS/Volian.Print.Library/Grid2Pdf.cs +++ b/PROMS/Volian.Print.Library/Grid2Pdf.cs @@ -452,7 +452,20 @@ namespace Volian.Print.Library // once there is valid value for TotalLeading (from previous line), you can use it to // calculate a MultipliedLeading to give 6 LPI (12 points) myPara.MultipliedLeading = 12.0f / myPara.TotalLeading; - myPara.MultipliedLeading = 12f / BiggestFontSize(myPara); // B2017-105, when box symbol size was increased, alignment in tables was off + float bfs = BiggestFontSize(myPara); + float sfs = SmallestFontSize(myPara); + // B2017-233, B2017-234 MultipliedLeading affects the vertical positon of the text in the table cell. When some characters in the table are either bigger or smaller + // than the font size defined in the plant's format, we need to adjust or recalulate the MultipliedLeading value. + // If the smallest font size is less that 10 then set the MultipliedLeading to 1 (need for AEP tables that use a smaller bullet character) + // if the the biggest font size is greater than 12 then we to calulate a new MultipliedLeading value base on BiggestFontSize + // The ogrinal fix(for B2017-105) was for Wolf Creek, but old logic broke for IP2/IP3, Calvert, Ginna, All Duke plants, and Commanche Peak + if (sfs < 10f) myPara.MultipliedLeading = 1f; + if (bfs > 12f) + { + //Console.WriteLine("multipliedLeading {0} bfs {1} sfs {2}", myPara.MultipliedLeading, bfs, sfs); + myPara.MultipliedLeading = 12f / bfs; // B2017-105, when box symbol size was increased, alignment in tables was off + //Console.WriteLine("multipliedLeading {0}", myPara.MultipliedLeading); + } myPara.SpacingAfter = 8; // RHM 20120925 - Add a line to properly space text from lines. if(Rtf2Pdf.GetTableScrunchingStatus(TableScrunching.Phase2)) // RHM20150429 - Table Scrunch myPara.SpacingAfter = 0;// YAdjust_SpacingAfter; // RHM 20120925 - Add a line to properly space text from lines. @@ -503,7 +516,21 @@ namespace Volian.Print.Library foreach (Chunk ck in myPara.Chunks) { fontSize = Math.Max(fontSize, ck.Font.Size); - if (ck.Font.Size > 12) ck.SetTextRise(-2f); + if (ck.Font.Size > 12) + { + ck.SetTextRise(-2f); + //_MyLog.WarnFormat("set text rise"); + } + } + return fontSize; + } + // B2017-233, B2017-234 needed to get the smallest font size to help decide if a vertical adjustment of the text is needed in a table cell + private float SmallestFontSize(Paragraph myPara) + { + float fontSize = 30; + foreach (Chunk ck in myPara.Chunks) + { + fontSize = Math.Min(fontSize, ck.Font.Size); } return fontSize; }