B2017-098 Adjust font size in Tables within Supplemantal Information
This commit is contained in:
parent
138b68bc38
commit
cbf44eb689
@ -1838,6 +1838,7 @@ namespace Volian.Print.Library
|
||||
private void ReduceSupInfoGroupFontSize(vlnParagraph pg, float scaler, PdfContentByte cb)
|
||||
{
|
||||
float hBefore = pg.Height;// Save initial paragraph height
|
||||
AdjustSupInfoTable(pg, scaler,cb);
|
||||
NewSupInfoFixChunks(pg,scaler);// Apply multiplier to font size
|
||||
pg.IParagraph.Leading = scaler * pg.IParagraph.Leading; // Adjust leading (line spacing)
|
||||
float hAfter = pg.GetParagraphHeight(cb, pg.IParagraph, "", pg.Width); // Calculate new paragraph height
|
||||
@ -1872,6 +1873,45 @@ namespace Volian.Print.Library
|
||||
NewSupInfoFixParts(po, scaler);
|
||||
}
|
||||
/// <summary>
|
||||
/// Adjust the Table Fonts to shrink the sup info text
|
||||
/// </summary>
|
||||
/// <param name="pg">vlnParagraph potentially containing a vlnTable</param>
|
||||
/// <param name="scaler">multiplier</param>
|
||||
/// <param name="cb">pdfContentByte</param>
|
||||
private void AdjustSupInfoTable(vlnParagraph pg, float scaler, PdfContentByte cb)
|
||||
{
|
||||
// Adjust the table if it exists
|
||||
if (pg.MyGrid != null)
|
||||
{
|
||||
// Create lists of heights before and after shrinking sup info
|
||||
Dictionary<int, float> beforeRowHeight = new Dictionary<int, float>();
|
||||
Dictionary<int, float> afterRowHeight = new Dictionary<int, float>();
|
||||
for (int i = 0; i < pg.MyGrid.RowTop.GetLength(0)-1; i++)
|
||||
{
|
||||
beforeRowHeight.Add(i, scaler * (pg.MyGrid.RowTop[i+1] - pg.MyGrid.RowTop[i]));
|
||||
afterRowHeight.Add(i, 0);
|
||||
}
|
||||
// Adjust font size for each cell.
|
||||
foreach (vlnCell cell in pg.MyGrid.MyCells)
|
||||
{
|
||||
float x = cell.MyTable.ColLeft[cell.c1];
|
||||
float w = cell.MyTable.ColLeft[cell.c2 + 1] - x;
|
||||
float hBefore = scaler * pg.GetParagraphHeight(cb,cell.MyPara,"",w);
|
||||
foreach (Chunk chk in cell.MyPara.Chunks)
|
||||
chk.Font.Size = scaler * chk.Font.Size;
|
||||
float hAfter = 1.075F * pg.GetParagraphHeight(cb,cell.MyPara,"",w);// 1.075 is a magic number that worked for Ginna. Otherwise decenders overlapped the bottom line of the cell.
|
||||
cell.HContent = hAfter;
|
||||
// Save tthe height after adjusting the font size to account for changes in word wrap.
|
||||
afterRowHeight[cell.r1]=Math.Max(hAfter,afterRowHeight[cell.r1]);
|
||||
}
|
||||
for (int i = 0; i < pg.MyGrid.RowTop.GetLength(0)-1; i++)
|
||||
{
|
||||
pg.MyGrid.RowTop[i+1] = scaler * pg.MyGrid.RowTop[i+1];// Adjust for leading
|
||||
pg.MyGrid.RowTop[i+1] += (afterRowHeight[i]-beforeRowHeight[i]); //Adjust for word wrapping
|
||||
}
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
/// Adjust YOffset for Print Objects
|
||||
/// </summary>
|
||||
/// <param name="vpo">Print Object (tab, paragraph, etc.)</param>
|
||||
|
Loading…
x
Reference in New Issue
Block a user