From 036ab51b7994ecc476090e11c92b6bb78ffd25b2 Mon Sep 17 00:00:00 2001 From: Gunnsteinn Hall Date: Tue, 14 Aug 2018 17:57:26 +0000 Subject: [PATCH] Address review comments. --- pdf/creator/table.go | 12 ++++++------ pdf/creator/table_test.go | 4 ++-- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/pdf/creator/table.go b/pdf/creator/table.go index c012957d..16c4d56c 100644 --- a/pdf/creator/table.go +++ b/pdf/creator/table.go @@ -207,7 +207,7 @@ func (table *Table) GeneratePageBlocks(ctx DrawContext) ([]*Block, DrawContext, newh += 0.5 * p.fontSize * p.lineHeight // TODO: Make the top margin configurable? if newh > h { diffh := newh - h - // Add diff to last row + // Add diff to last row. table.rowHeights[cell.row+cell.rowspan-2] += diffh } case *Image: @@ -215,7 +215,7 @@ func (table *Table) GeneratePageBlocks(ctx DrawContext) ([]*Block, DrawContext, newh := img.Height() + img.margins.top + img.margins.bottom if newh > h { diffh := newh - h - // Add diff to last row + // Add diff to last row. table.rowHeights[cell.row+cell.rowspan-2] += diffh } case *Division: @@ -238,7 +238,7 @@ func (table *Table) GeneratePageBlocks(ctx DrawContext) ([]*Block, DrawContext, newh := ctx.Height - h if newh > h { diffh := newh - h - // Add diff to last row + // Add diff to last row. table.rowHeights[cell.row+cell.rowspan-2] += diffh } } @@ -249,7 +249,7 @@ func (table *Table) GeneratePageBlocks(ctx DrawContext) ([]*Block, DrawContext, // Get available width and height. if newh > h { diffh := newh - h - // Add diff to last row + // Add diff to last row. table.rowHeights[cell.row+cell.rowspan-2] += diffh } } @@ -394,9 +394,9 @@ func (table *Table) GeneratePageBlocks(ctx DrawContext) ([]*Block, DrawContext, // Relative mode. // Move back X after. ctx.X = origCtx.X - // Return original width + // Return original width. ctx.Width = origCtx.Width - // Add the bottom margin + // Add the bottom margin. ctx.Y += table.margins.bottom return blocks, ctx, nil diff --git a/pdf/creator/table_test.go b/pdf/creator/table_test.go index 12c76b41..372f95b3 100644 --- a/pdf/creator/table_test.go +++ b/pdf/creator/table_test.go @@ -83,7 +83,7 @@ func TestTableWithImage(t *testing.T) { pageHistoryTable.SkipCells(1) - // Add image + // Add image. imgData, err := ioutil.ReadFile(testImageFile1) if err != nil { t.Errorf("Fail: %v\n", err) @@ -195,7 +195,7 @@ func TestTableWithDiv(t *testing.T) { pageHistoryTable.SkipCells(1) - // Add image + // Add image. imgData, err := ioutil.ReadFile(testImageFile1) if err != nil { t.Errorf("Fail: %v\n", err)