Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feature/Bottom padding for text in automatic row calculation #478

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ mocks:
.PHONY: examples
examples:
go run docs/assets/examples/addpage/v2/main.go
go run docs/assets/examples/autorow/v2/main.go
go run docs/assets/examples/background/v2/main.go
go run docs/assets/examples/barcodegrid/v2/main.go
go run docs/assets/examples/billing/v2/main.go
Expand Down
9 changes: 9 additions & 0 deletions docs/assets/examples/autorow/v2/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,15 @@ func GetMaroto() core.Maroto {
}),
)

m.AddAutoRow(
image.NewFromFileCol(5, "docs/assets/images/biplane.jpg"),
text.NewCol(7, intro, props.Text{
Size: 13,
Top: 8,
Bottom: 9,
}),
)

m.AddAutoRow(
code.NewBarCol(4, "code"),
text.NewCol(8, intro),
Expand Down
Binary file modified docs/assets/pdf/addpagev2.pdf
Binary file not shown.
Binary file modified docs/assets/pdf/autorow.pdf
Binary file not shown.
Binary file modified docs/assets/pdf/backgroundv2.pdf
Binary file not shown.
Binary file modified docs/assets/pdf/barcodegridv2.pdf
Binary file not shown.
Binary file modified docs/assets/pdf/billingv2.pdf
Binary file not shown.
Binary file modified docs/assets/pdf/cellstylev2.pdf
Binary file not shown.
Binary file modified docs/assets/pdf/compressionv2.pdf
Binary file not shown.
Binary file modified docs/assets/pdf/customdimensionsv2.pdf
Binary file not shown.
Binary file modified docs/assets/pdf/customfontv2.pdf
Binary file not shown.
Binary file modified docs/assets/pdf/custompagev2.pdf
Binary file not shown.
Binary file modified docs/assets/pdf/datamatrixgridv2.pdf
Binary file not shown.
Binary file modified docs/assets/pdf/disablepagebreakv2.pdf
Binary file not shown.
Binary file modified docs/assets/pdf/footerv2.pdf
Binary file not shown.
Binary file modified docs/assets/pdf/headerv2.pdf
Binary file not shown.
Binary file modified docs/assets/pdf/imagegridv2.pdf
Binary file not shown.
Binary file modified docs/assets/pdf/linegridv2.pdf
Binary file not shown.
Binary file modified docs/assets/pdf/listv2.pdf
Binary file not shown.
Binary file modified docs/assets/pdf/lowmemoryv2.pdf
Binary file not shown.
Binary file modified docs/assets/pdf/marginsv2.pdf
Binary file not shown.
Binary file modified docs/assets/pdf/maxgridsumv2.pdf
Binary file not shown.
Binary file modified docs/assets/pdf/mergepdfv2.pdf
Binary file not shown.
Binary file modified docs/assets/pdf/metadatasv2.pdf
Binary file not shown.
Binary file modified docs/assets/pdf/orientationv2.pdf
Binary file not shown.
Binary file modified docs/assets/pdf/pagenumberv2.pdf
Binary file not shown.
Binary file modified docs/assets/pdf/parallelismv2.pdf
Binary file not shown.
Binary file modified docs/assets/pdf/protectionv2.pdf
Binary file not shown.
Binary file modified docs/assets/pdf/qrgridv2.pdf
Binary file not shown.
Binary file modified docs/assets/pdf/signaturegridv2.pdf
Binary file not shown.
Binary file modified docs/assets/pdf/simplestv2.pdf
Binary file not shown.
Binary file modified docs/assets/pdf/textgridv2.pdf
Binary file not shown.
4 changes: 2 additions & 2 deletions docs/assets/text/addpagev2.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
generate -> avg: 2.53ms, executions: [2.53ms]
add_page -> avg: 1589.00ns, executions: [1.59μs]
generate -> avg: 3.18ms, executions: [3.18ms]
add_page -> avg: 2696.00ns, executions: [2.70μs]
file_size -> 5.64Kb
4 changes: 2 additions & 2 deletions docs/assets/text/autorow.txt
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
generate -> avg: 2.94ms, executions: [2.94ms]
file_size -> 219.47Kb
generate -> avg: 3.21ms, executions: [3.21ms]
file_size -> 221.07Kb
4 changes: 2 additions & 2 deletions docs/assets/text/backgroundv2.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
generate -> avg: 566.80ms, executions: [566.80ms]
add_page -> avg: 7133.00ns, executions: [7.13μs]
generate -> avg: 645.27ms, executions: [645.27ms]
add_page -> avg: 5223.00ns, executions: [5.22μs]
file_size -> 897.39Kb
4 changes: 2 additions & 2 deletions docs/assets/text/barcodegridv2.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
generate -> avg: 2.84ms, executions: [2.84ms]
add_row -> avg: 404.80ns, executions: [1.03μs, 0.36μs, 0.23μs, 0.17μs, 0.23μs]
generate -> avg: 1.37ms, executions: [1.37ms]
add_row -> avg: 358.60ns, executions: [1.16μs, 0.17μs, 0.15μs, 0.10μs, 0.22μs]
file_size -> 16.54Kb
10 changes: 5 additions & 5 deletions docs/assets/text/billingv2.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
generate -> avg: 24.86ms, executions: [24.86ms]
header -> avg: 1.01μs, executions: [1.01μs]
footer -> avg: 94.00ns, executions: [94.00ns]
add_row -> avg: 239.00ns, executions: [189.00ns, 289.00ns]
add_rows -> avg: 785.00ns, executions: [0.21μs, 1.36μs]
generate -> avg: 25.70ms, executions: [25.70ms]
header -> avg: 1.78μs, executions: [1.78μs]
footer -> avg: 125.00ns, executions: [125.00ns]
add_row -> avg: 255.50ns, executions: [202.00ns, 309.00ns]
add_rows -> avg: 916.50ns, executions: [0.24μs, 1.59μs]
file_size -> 231.69Kb
4 changes: 2 additions & 2 deletions docs/assets/text/cellstylev2.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
generate -> avg: 16.26ms, executions: [16.26ms]
add_rows -> avg: 131.45ns, executions: [0.72μs, 0.21μs, 0.15μs, 0.09μs, 0.11μs, 0.07μs, 0.06μs, 0.07μs, 0.10μs, 0.07μs, 0.04μs, 0.07μs, 0.04μs, 0.07μs, 0.04μs, 0.10μs, 2.35μs, 0.09μs, 0.04μs, 0.08μs, 0.05μs, 0.07μs, 0.04μs, 0.06μs, 0.04μs, 0.07μs, 0.43μs, 0.13μs, 0.08μs, 0.07μs, 0.09μs, 0.09μs, 0.05μs, 0.07μs, 0.09μs, 0.07μs, 0.04μs, 0.07μs, 0.04μs, 0.09μs, 0.07μs, 0.07μs, 0.12μs, 0.07μs, 0.04μs, 0.07μs, 0.04μs, 0.07μs, 0.04μs, 0.07μs, 0.03μs, 0.06μs, 0.28μs, 0.11μs, 0.09μs, 0.08μs, 0.09μs, 0.08μs, 0.04μs, 0.09μs]
generate -> avg: 18.81ms, executions: [18.81ms]
add_rows -> avg: 218.25ns, executions: [1.02μs, 0.28μs, 0.20μs, 0.11μs, 0.22μs, 0.08μs, 0.07μs, 0.08μs, 0.25μs, 0.08μs, 0.05μs, 0.07μs, 0.21μs, 1.43μs, 0.05μs, 0.10μs, 0.46μs, 0.10μs, 0.05μs, 0.08μs, 0.05μs, 0.08μs, 0.04μs, 0.08μs, 0.06μs, 0.08μs, 0.60μs, 0.16μs, 0.09μs, 0.07μs, 0.10μs, 0.08μs, 0.05μs, 0.10μs, 0.12μs, 4.28μs, 0.12μs, 0.12μs, 0.05μs, 0.08μs, 0.04μs, 0.08μs, 0.13μs, 0.08μs, 0.05μs, 0.08μs, 0.06μs, 0.08μs, 0.05μs, 0.07μs, 0.05μs, 0.07μs, 0.32μs, 0.10μs, 0.09μs, 0.08μs, 0.09μs, 0.08μs, 0.04μs, 0.07μs]
file_size -> 28.60Kb
4 changes: 2 additions & 2 deletions docs/assets/text/compressionv2.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
generate -> avg: 3.57ms, executions: [3.57ms]
add_rows -> avg: 274.00ns, executions: [524.00ns, 296.00ns, 180.00ns, 96.00ns]
generate -> avg: 8.33ms, executions: [8.33ms]
add_rows -> avg: 699.50ns, executions: [0.60μs, 1.07μs, 0.85μs, 0.28μs]
file_size -> 224.69Kb
4 changes: 2 additions & 2 deletions docs/assets/text/customdimensionsv2.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
generate -> avg: 877.17μs, executions: [877.17μs]
add_row -> avg: 772.00ns, executions: [772.00ns]
generate -> avg: 5.72ms, executions: [5.72ms]
add_row -> avg: 1543.00ns, executions: [1.54μs]
file_size -> 205.24Kb
6 changes: 3 additions & 3 deletions docs/assets/text/customfontv2.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
generate -> avg: 35.13ms, executions: [35.13ms]
add_row -> avg: 117.07ns, executions: [1.75μs, 0.23μs, 0.14μs, 0.07μs, 0.13μs, 0.07μs, 0.07μs, 0.06μs, 0.13μs, 0.06μs, 0.06μs, 0.06μs, 0.06μs, 0.06μs, 0.06μs, 0.06μs, 0.16μs, 0.07μs, 0.06μs, 0.06μs, 0.06μs, 0.06μs, 0.06μs, 0.06μs, 0.07μs, 0.07μs, 0.07μs, 0.06μs, 0.06μs, 0.07μs, 0.11μs, 0.06μs, 0.19μs, 0.06μs, 0.06μs, 0.08μs, 0.06μs, 0.06μs, 0.06μs, 0.06μs, 0.06μs, 0.06μs, 0.06μs, 0.06μs, 0.06μs, 0.06μs, 0.06μs, 0.06μs, 0.06μs, 0.06μs, 0.06μs, 0.06μs, 0.67μs, 0.12μs, 0.11μs, 0.06μs, 0.11μs, 0.06μs, 0.07μs, 0.07μs, 1.10μs, 0.07μs, 0.06μs, 0.06μs, 0.07μs, 0.07μs, 0.07μs, 0.07μs, 0.15μs, 0.07μs, 0.06μs, 0.07μs, 0.06μs, 0.06μs, 0.06μs, 0.06μs, 0.06μs, 0.06μs, 0.06μs, 0.06μs, 0.06μs, 0.07μs, 0.06μs, 0.06μs, 0.13μs, 0.06μs, 0.06μs, 0.07μs, 0.06μs, 0.06μs, 0.06μs, 0.06μs, 0.06μs, 0.06μs, 0.06μs, 0.06μs, 0.06μs, 0.06μs, 0.06μs, 0.06μs, 0.07μs, 0.06μs, 0.06μs, 0.06μs, 0.06μs, 1.52μs, 0.10μs, 0.11μs, 0.07μs, 0.12μs, 0.14μs]
add_rows -> avg: 93.00ns, executions: [93.00ns]
generate -> avg: 48.70ms, executions: [48.70ms]
add_row -> avg: 324.05ns, executions: [2.45μs, 0.49μs, 0.22μs, 0.11μs, 0.44μs, 0.10μs, 0.09μs, 0.09μs, 0.28μs, 0.09μs, 0.13μs, 0.12μs, 0.09μs, 0.09μs, 0.09μs, 0.09μs, 0.62μs, 0.09μs, 0.09μs, 0.31μs, 0.10μs, 0.09μs, 0.09μs, 0.31μs, 0.10μs, 0.10μs, 0.09μs, 0.10μs, 0.10μs, 0.09μs, 0.09μs, 0.09μs, 3.95μs, 0.26μs, 0.10μs, 0.09μs, 0.09μs, 0.31μs, 0.10μs, 0.09μs, 0.09μs, 0.43μs, 0.10μs, 0.10μs, 0.09μs, 0.09μs, 0.09μs, 0.09μs, 0.09μs, 0.09μs, 0.09μs, 0.09μs, 7.71μs, 0.33μs, 0.36μs, 0.10μs, 0.16μs, 0.09μs, 0.10μs, 0.09μs, 6.81μs, 0.26μs, 0.30μs, 0.10μs, 0.10μs, 0.10μs, 0.10μs, 0.09μs, 0.26μs, 0.09μs, 0.10μs, 0.09μs, 0.09μs, 0.09μs, 0.09μs, 0.11μs, 0.09μs, 0.09μs, 0.09μs, 0.09μs, 0.09μs, 0.09μs, 0.09μs, 0.09μs, 0.21μs, 0.09μs, 0.09μs, 0.10μs, 0.11μs, 0.09μs, 0.11μs, 0.10μs, 0.09μs, 0.09μs, 0.09μs, 0.09μs, 0.09μs, 0.09μs, 0.09μs, 0.09μs, 0.09μs, 0.09μs, 0.11μs, 0.09μs, 0.10μs, 0.73μs, 0.15μs, 0.20μs, 0.10μs, 0.14μs, 0.20μs]
add_rows -> avg: 140.00ns, executions: [140.00ns]
file_size -> 286.87Kb
4 changes: 2 additions & 2 deletions docs/assets/text/custompagev2.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
generate -> avg: 890.15μs, executions: [890.15μs]
add_row -> avg: 605.00ns, executions: [605.00ns]
generate -> avg: 5.24ms, executions: [5.24ms]
add_row -> avg: 1197.00ns, executions: [1.20μs]
file_size -> 205.16Kb
4 changes: 2 additions & 2 deletions docs/assets/text/datamatrixgridv2.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
generate -> avg: 208.60μs, executions: [208.60μs]
add_row -> avg: 288.25ns, executions: [833.00ns, 145.00ns, 105.00ns, 70.00ns]
generate -> avg: 177.74μs, executions: [177.74μs]
add_row -> avg: 315.50ns, executions: [876.00ns, 162.00ns, 134.00ns, 90.00ns]
file_size -> 5.27Kb
4 changes: 2 additions & 2 deletions docs/assets/text/disablepagebreakv2.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
generate -> avg: 137.31ms, executions: [137.31ms]
add_page -> avg: 396.00ns, executions: [396.00ns]
generate -> avg: 130.19ms, executions: [130.19ms]
add_page -> avg: 495.00ns, executions: [495.00ns]
file_size -> 806.50Kb
6 changes: 3 additions & 3 deletions docs/assets/text/footerv2.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
generate -> avg: 11.36ms, executions: [11.36ms]
footer -> avg: 358.00ns, executions: [358.00ns]
add_rows -> avg: 109.78ns, executions: [0.43μs, 0.11μs, 0.09μs, 0.04μs, 0.08μs, 0.03μs, 0.03μs, 0.03μs, 0.08μs, 0.03μs, 0.03μs, 0.02μs, 0.02μs, 0.02μs, 0.03μs, 0.03μs, 2.38μs, 0.03μs, 0.04μs, 0.03μs, 0.03μs, 0.03μs, 0.03μs, 0.02μs, 0.61μs, 0.09μs, 0.06μs, 0.03μs, 0.07μs, 0.03μs, 0.03μs, 0.03μs, 0.07μs, 0.03μs, 0.03μs, 0.03μs, 0.03μs, 0.02μs, 0.02μs, 0.02μs, 0.10μs, 0.03μs, 0.03μs, 0.03μs, 0.03μs, 0.03μs, 0.03μs, 0.03μs, 0.31μs, 0.07μs]
generate -> avg: 10.27ms, executions: [10.27ms]
footer -> avg: 1.09μs, executions: [1.09μs]
add_rows -> avg: 88.82ns, executions: [257.00ns, 118.00ns, 90.00ns, 45.00ns, 101.00ns, 40.00ns, 31.00ns, 30.00ns, 167.00ns, 39.00ns, 32.00ns, 29.00ns, 31.00ns, 31.00ns, 30.00ns, 30.00ns, 554.00ns, 32.00ns, 30.00ns, 29.00ns, 215.00ns, 32.00ns, 32.00ns, 35.00ns, 607.00ns, 122.00ns, 72.00ns, 31.00ns, 70.00ns, 31.00ns, 33.00ns, 32.00ns, 82.00ns, 29.00ns, 32.00ns, 31.00ns, 30.00ns, 30.00ns, 33.00ns, 32.00ns, 104.00ns, 33.00ns, 30.00ns, 260.00ns, 46.00ns, 37.00ns, 33.00ns, 33.00ns, 443.00ns, 65.00ns]
file_size -> 14.76Kb
6 changes: 3 additions & 3 deletions docs/assets/text/headerv2.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
generate -> avg: 8.85ms, executions: [8.85ms]
header -> avg: 502.00ns, executions: [502.00ns]
add_rows -> avg: 92.06ns, executions: [0.18μs, 0.06μs, 0.04μs, 0.07μs, 0.03μs, 0.02μs, 0.02μs, 0.07μs, 0.02μs, 0.02μs, 0.02μs, 0.02μs, 0.02μs, 0.02μs, 0.02μs, 2.20μs, 0.03μs, 0.02μs, 0.03μs, 0.02μs, 0.02μs, 0.02μs, 0.03μs, 0.02μs, 0.50μs, 0.08μs, 0.02μs, 0.06μs, 0.03μs, 0.02μs, 0.02μs, 0.07μs, 0.03μs, 0.02μs, 0.02μs, 0.02μs, 0.03μs, 0.03μs, 0.02μs, 0.09μs, 0.02μs, 0.02μs, 0.02μs, 0.03μs, 0.02μs, 0.02μs, 0.02μs, 0.02μs, 0.26μs, 0.06μs]
generate -> avg: 10.76ms, executions: [10.76ms]
header -> avg: 1.39μs, executions: [1.39μs]
add_rows -> avg: 95.96ns, executions: [250.00ns, 92.00ns, 47.00ns, 259.00ns, 40.00ns, 33.00ns, 32.00ns, 228.00ns, 32.00ns, 33.00ns, 35.00ns, 33.00ns, 32.00ns, 31.00ns, 31.00ns, 590.00ns, 35.00ns, 32.00ns, 32.00ns, 257.00ns, 35.00ns, 36.00ns, 36.00ns, 36.00ns, 790.00ns, 103.00ns, 35.00ns, 83.00ns, 34.00ns, 32.00ns, 32.00ns, 90.00ns, 33.00ns, 31.00ns, 33.00ns, 33.00ns, 33.00ns, 30.00ns, 34.00ns, 112.00ns, 32.00ns, 30.00ns, 32.00ns, 253.00ns, 35.00ns, 35.00ns, 34.00ns, 35.00ns, 398.00ns, 79.00ns]
file_size -> 14.75Kb
4 changes: 2 additions & 2 deletions docs/assets/text/imagegridv2.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
generate -> avg: 11.30ms, executions: [11.30ms]
add_row -> avg: 315.83ns, executions: [954.00ns, 264.00ns, 254.00ns, 146.00ns, 169.00ns, 108.00ns]
generate -> avg: 4.76ms, executions: [4.76ms]
add_row -> avg: 292.83ns, executions: [1.03μs, 0.18μs, 0.19μs, 0.12μs, 0.15μs, 0.08μs]
file_size -> 224.21Kb
4 changes: 2 additions & 2 deletions docs/assets/text/linegridv2.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
generate -> avg: 86.67μs, executions: [86.67μs]
add_row -> avg: 232.60ns, executions: [661.00ns, 162.00ns, 119.00ns, 82.00ns, 139.00ns]
generate -> avg: 118.60μs, executions: [118.60μs]
add_row -> avg: 431.60ns, executions: [1.28μs, 0.25μs, 0.22μs, 0.12μs, 0.29μs]
file_size -> 2.89Kb
4 changes: 2 additions & 2 deletions docs/assets/text/listv2.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
generate -> avg: 39.47ms, executions: [39.47ms]
add_rows -> avg: 4802.00ns, executions: [4.80μs]
generate -> avg: 47.81ms, executions: [47.81ms]
add_rows -> avg: 8002.00ns, executions: [8.00μs]
file_size -> 48.85Kb
4 changes: 2 additions & 2 deletions docs/assets/text/lowmemoryv2.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
generate -> avg: 9.86ms, executions: [9.86ms]
add_rows -> avg: 97.34ns, executions: [0.81μs, 0.11μs, 0.06μs, 0.04μs, 0.06μs, 0.03μs, 0.02μs, 0.02μs, 0.09μs, 0.02μs, 0.02μs, 0.02μs, 0.02μs, 0.02μs, 0.02μs, 0.02μs, 2.07μs, 0.03μs, 0.02μs, 0.02μs, 0.02μs, 0.02μs, 0.02μs, 0.02μs, 0.02μs, 0.03μs, 0.43μs, 0.08μs, 0.06μs, 0.02μs, 0.06μs, 0.02μs, 0.02μs, 0.02μs, 0.06μs, 0.02μs, 0.02μs, 0.02μs, 0.02μs, 0.02μs, 0.02μs, 0.02μs, 0.09μs, 0.02μs, 0.02μs, 0.02μs, 0.02μs, 0.02μs, 0.02μs, 0.03μs]
generate -> avg: 14.09ms, executions: [14.09ms]
add_rows -> avg: 102.38ns, executions: [1.12μs, 0.13μs, 0.09μs, 0.05μs, 0.11μs, 0.04μs, 0.04μs, 0.04μs, 0.13μs, 0.04μs, 0.04μs, 0.04μs, 0.04μs, 0.04μs, 0.03μs, 0.04μs, 0.54μs, 0.04μs, 0.04μs, 0.03μs, 0.03μs, 0.04μs, 0.04μs, 0.04μs, 0.27μs, 0.04μs, 0.88μs, 0.11μs, 0.08μs, 0.04μs, 0.09μs, 0.05μs, 0.03μs, 0.03μs, 0.09μs, 0.04μs, 0.03μs, 0.04μs, 0.04μs, 0.04μs, 0.04μs, 0.04μs, 0.12μs, 0.04μs, 0.03μs, 0.03μs, 0.04μs, 0.04μs, 0.04μs, 0.04μs]
file_size -> 2.52Kb
6 changes: 3 additions & 3 deletions docs/assets/text/marginsv2.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
generate -> avg: 375.09ms, executions: [375.09ms]
header -> avg: 571.00ns, executions: [571.00ns]
add_rows -> avg: 100.50ns, executions: [186.00ns, 64.00ns, 32.00ns, 59.00ns, 22.00ns, 23.00ns, 23.00ns, 518.00ns, 57.00ns, 21.00ns]
generate -> avg: 491.90ms, executions: [491.90ms]
header -> avg: 1.67μs, executions: [1.67μs]
add_rows -> avg: 151.10ns, executions: [260.00ns, 92.00ns, 50.00ns, 121.00ns, 48.00ns, 36.00ns, 37.00ns, 733.00ns, 88.00ns, 46.00ns]
file_size -> 256.74Kb
6 changes: 3 additions & 3 deletions docs/assets/text/maxgridsumv2.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
generate -> avg: 8.11ms, executions: [8.11ms]
add_row -> avg: 1421.50ns, executions: [2.45μs, 0.39μs]
add_rows -> avg: 843.00ns, executions: [843.00ns]
generate -> avg: 6.14ms, executions: [6.14ms]
add_row -> avg: 621.00ns, executions: [845.00ns, 397.00ns]
add_rows -> avg: 1292.00ns, executions: [1.29μs]
file_size -> 8.13Kb
6 changes: 3 additions & 3 deletions docs/assets/text/mergepdfv2.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
generate -> avg: 16.83ms, executions: [16.83ms]
add_rows -> avg: 97.58ns, executions: [0.40μs, 0.11μs, 0.07μs, 0.04μs, 0.07μs, 0.03μs, 0.03μs, 0.03μs, 0.09μs, 0.03μs, 0.02μs, 0.02μs, 0.02μs, 2.01μs, 0.08μs, 0.06μs, 0.02μs, 0.07μs, 0.03μs, 0.04μs, 0.02μs, 0.06μs, 0.02μs, 0.02μs, 0.03μs, 0.03μs, 0.30μs, 0.06μs, 0.06μs, 0.02μs, 0.06μs, 0.02μs, 0.03μs, 0.03μs, 0.08μs, 0.06μs, 0.03μs, 0.02μs, 0.02μs, 0.23μs, 0.06μs, 0.06μs, 0.02μs, 0.06μs, 0.02μs, 0.03μs, 0.03μs, 0.08μs, 0.03μs, 0.03μs]
merge_pdf -> avg: 4.11ms, executions: [4.11ms]
generate -> avg: 12.13ms, executions: [12.13ms]
add_rows -> avg: 106.46ns, executions: [1.09μs, 0.13μs, 0.10μs, 0.05μs, 0.12μs, 0.04μs, 0.04μs, 0.04μs, 0.11μs, 0.04μs, 0.04μs, 0.03μs, 0.04μs, 0.87μs, 0.08μs, 0.06μs, 0.03μs, 0.08μs, 0.04μs, 0.03μs, 0.03μs, 0.10μs, 0.04μs, 0.24μs, 0.04μs, 0.04μs, 0.35μs, 0.08μs, 0.08μs, 0.04μs, 0.09μs, 0.04μs, 0.04μs, 0.04μs, 0.09μs, 0.03μs, 0.04μs, 0.03μs, 0.03μs, 0.28μs, 0.08μs, 0.08μs, 0.03μs, 0.09μs, 0.04μs, 0.04μs, 0.04μs, 0.09μs, 0.03μs, 0.03μs]
merge_pdf -> avg: 1.83ms, executions: [1.83ms]
file_size -> 280.85Kb
4 changes: 2 additions & 2 deletions docs/assets/text/metadatasv2.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
generate -> avg: 217.90μs, executions: [217.90μs]
add_rows -> avg: 554.00ns, executions: [554.00ns]
generate -> avg: 362.78μs, executions: [362.78μs]
add_rows -> avg: 1381.00ns, executions: [1.38μs]
file_size -> 1.32Kb
4 changes: 2 additions & 2 deletions docs/assets/text/orientationv2.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
generate -> avg: 220.83μs, executions: [220.83μs]
add_rows -> avg: 364.00ns, executions: [364.00ns]
generate -> avg: 281.33μs, executions: [281.33μs]
add_rows -> avg: 1066.00ns, executions: [1.07μs]
file_size -> 1.29Kb
4 changes: 2 additions & 2 deletions docs/assets/text/pagenumberv2.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
generate -> avg: 2.95ms, executions: [2.95ms]
add_rows -> avg: 240.13ns, executions: [0.52μs, 0.10μs, 0.06μs, 0.03μs, 0.07μs, 0.03μs, 0.02μs, 0.02μs, 0.08μs, 0.03μs, 0.02μs, 0.02μs, 0.02μs, 2.51μs, 0.07μs]
generate -> avg: 4.08ms, executions: [4.08ms]
add_rows -> avg: 167.53ns, executions: [920.00ns, 141.00ns, 91.00ns, 56.00ns, 132.00ns, 44.00ns, 36.00ns, 35.00ns, 121.00ns, 36.00ns, 35.00ns, 35.00ns, 34.00ns, 724.00ns, 73.00ns]
file_size -> 5.72Kb
4 changes: 2 additions & 2 deletions docs/assets/text/parallelismv2.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
generate -> avg: 5.52ms, executions: [5.52ms]
add_rows -> avg: 102.30ns, executions: [0.62μs, 0.10μs, 0.07μs, 0.03μs, 0.07μs, 0.03μs, 0.02μs, 0.02μs, 0.07μs, 0.02μs, 0.02μs, 0.02μs, 0.02μs, 0.02μs, 0.02μs, 0.02μs, 2.41μs, 0.02μs, 0.02μs, 0.02μs, 0.03μs, 0.02μs, 0.02μs, 0.02μs, 0.02μs, 0.04μs, 0.48μs, 0.08μs, 0.10μs, 0.02μs, 0.07μs, 0.02μs, 0.02μs, 0.02μs, 0.05μs, 0.02μs, 0.02μs, 0.02μs, 0.02μs, 0.02μs, 0.02μs, 0.02μs, 0.08μs, 0.02μs, 0.02μs, 0.02μs, 0.03μs, 0.02μs, 0.03μs, 0.03μs]
generate -> avg: 10.81ms, executions: [10.81ms]
add_rows -> avg: 102.58ns, executions: [1.40μs, 0.13μs, 0.10μs, 0.04μs, 0.10μs, 0.04μs, 0.04μs, 0.04μs, 0.12μs, 0.03μs, 0.03μs, 0.03μs, 0.04μs, 0.03μs, 0.03μs, 0.03μs, 0.52μs, 0.04μs, 0.04μs, 0.03μs, 0.03μs, 0.04μs, 0.04μs, 0.05μs, 0.25μs, 0.04μs, 0.68μs, 0.12μs, 0.09μs, 0.04μs, 0.10μs, 0.04μs, 0.03μs, 0.03μs, 0.09μs, 0.04μs, 0.04μs, 0.04μs, 0.04μs, 0.04μs, 0.04μs, 0.03μs, 0.11μs, 0.04μs, 0.03μs, 0.04μs, 0.04μs, 0.03μs, 0.03μs, 0.04μs]
file_size -> 2.52Kb
4 changes: 2 additions & 2 deletions docs/assets/text/protectionv2.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
generate -> avg: 232.51μs, executions: [232.51μs]
add_rows -> avg: 609.00ns, executions: [609.00ns]
generate -> avg: 310.73μs, executions: [310.73μs]
add_rows -> avg: 988.00ns, executions: [988.00ns]
file_size -> 1.42Kb
4 changes: 2 additions & 2 deletions docs/assets/text/qrgridv2.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
generate -> avg: 203.90μs, executions: [203.90μs]
add_row -> avg: 232.00ns, executions: [619.00ns, 132.00ns, 106.00ns, 71.00ns]
generate -> avg: 199.99μs, executions: [199.99μs]
add_row -> avg: 426.00ns, executions: [1.25μs, 0.21μs, 0.14μs, 0.10μs]
file_size -> 5.34Kb
4 changes: 2 additions & 2 deletions docs/assets/text/signaturegridv2.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
generate -> avg: 2.13ms, executions: [2.13ms]
add_row -> avg: 255.00ns, executions: [502.00ns, 143.00ns, 120.00ns]
generate -> avg: 2.90ms, executions: [2.90ms]
add_row -> avg: 520.00ns, executions: [1.19μs, 0.23μs, 0.14μs]
file_size -> 6.27Kb
6 changes: 3 additions & 3 deletions docs/assets/text/textgridv2.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
generate -> avg: 36.66ms, executions: [36.66ms]
add_row -> avg: 1401.00ns, executions: [3.05μs, 0.88μs, 0.61μs, 0.58μs, 0.66μs, 2.62μs]
add_rows -> avg: 368.83ns, executions: [511.00ns, 430.00ns, 190.00ns, 441.00ns, 130.00ns, 511.00ns]
generate -> avg: 6.61ms, executions: [6.61ms]
add_row -> avg: 494.50ns, executions: [1.50μs, 0.24μs, 0.14μs, 0.10μs, 0.12μs, 0.86μs]
add_rows -> avg: 109.83ns, executions: [181.00ns, 115.00ns, 58.00ns, 142.00ns, 53.00ns, 110.00ns]
file_size -> 30.68Kb
1 change: 1 addition & 0 deletions internal/fixture/fixture.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ func TextProp() props.Text {

prop := props.Text{
Top: 12,
Bottom: 13,
Left: 3,
Family: fontProp.Family,
Style: fontProp.Style,
Expand Down
2 changes: 1 addition & 1 deletion pkg/components/text/text.go
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ func (t *Text) GetHeight(provider core.Provider, cell *entity.Cell) float64 {
amountLines := provider.GetLinesQuantity(t.value, &t.prop, cell.Width-t.prop.Left-t.prop.Right)
fontHeight := provider.GetFontHeight(&props.Font{Family: t.prop.Family, Style: t.prop.Style, Size: t.prop.Size, Color: t.prop.Color})
textHeight := float64(amountLines)*fontHeight + float64(amountLines-1)*t.prop.VerticalPadding
return textHeight + t.prop.Top
return textHeight + t.prop.Top + t.prop.Bottom
}

// SetConfig sets the config.
Expand Down
9 changes: 9 additions & 0 deletions pkg/props/text.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@
type Text struct {
// Top is the amount of space between the upper cell limit and the text.
Top float64
// Bottom is the amount of space between the lower cell limit and the text. (Used by auto row only)
Bottom float64
// Left is the minimal amount of space between the left cell boundary and the text.
Left float64
// Right is the minimal amount of space between the right cell boundary and the text.
Expand Down Expand Up @@ -39,6 +41,9 @@
if t.Top != 0 {
m["prop_top"] = t.Top
}
if t.Bottom != 0 {
m["prop_bottom"] = t.Bottom

Check warning on line 45 in pkg/props/text.go

View check run for this annotation

Codecov / codecov/patch

pkg/props/text.go#L44-L45

Added lines #L44 - L45 were not covered by tests
}

if t.Left != 0 {
m["prop_left"] = t.Left
Expand Down Expand Up @@ -112,6 +117,10 @@
t.Top = minValue
}

if t.Bottom < minValue {
t.Bottom = minValue

Check warning on line 121 in pkg/props/text.go

View check run for this annotation

Codecov / codecov/patch

pkg/props/text.go#L121

Added line #L121 was not covered by tests
}

if t.Left < minValue {
t.Left = minValue
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
"type": "text",
"details": {
"prop_align": "R",
"prop_bottom": 13,
"prop_breakline_strategy": "dash_strategy",
"prop_color": "RGB(100, 50, 200)",
"prop_font_family": "helvetica",
Expand Down
1 change: 1 addition & 0 deletions test/maroto/components/texts/new_text_col_custom_prop.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
"type": "text",
"details": {
"prop_align": "R",
"prop_bottom": 13,
"prop_breakline_strategy": "dash_strategy",
"prop_color": "RGB(100, 50, 200)",
"prop_font_family": "helvetica",
Expand Down
1 change: 1 addition & 0 deletions test/maroto/components/texts/new_text_custom_prop.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
"type": "text",
"details": {
"prop_align": "R",
"prop_bottom": 13,
"prop_breakline_strategy": "dash_strategy",
"prop_color": "RGB(100, 50, 200)",
"prop_font_family": "helvetica",
Expand Down
1 change: 1 addition & 0 deletions test/maroto/components/texts/new_text_row_custom_prop.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
"type": "text",
"details": {
"prop_align": "R",
"prop_bottom": 13,
"prop_breakline_strategy": "dash_strategy",
"prop_color": "RGB(100, 50, 200)",
"prop_font_family": "helvetica",
Expand Down
Loading
Loading