Inter-Bold.ttf 🔗
Maas Lalani created
Inter-Bold.ttf | 0
invoice.pdf | 0
main.go | 8 ++++++++
pdf.go | 5 ++++-
4 files changed, 12 insertions(+), 1 deletion(-)
@@ -15,6 +15,9 @@ import (
//go:embed Inter.ttf
var interFont []byte
+//go:embed Inter-Bold.ttf
+var interBoldFont []byte
+
var (
id string
title string
@@ -83,6 +86,11 @@ var generateCmd = &cobra.Command{
return err
}
+ err = pdf.AddTTFFontData("Inter-Bold", interBoldFont)
+ if err != nil {
+ return err
+ }
+
writeLogo(&pdf, logo, from)
writeTitle(&pdf, title, id)
writeBillTo(&pdf, to)
@@ -32,7 +32,7 @@ func writeLogo(pdf *gopdf.GoPdf, logo string, from string) {
}
func writeTitle(pdf *gopdf.GoPdf, title, id string) {
- _ = pdf.SetFont("Inter", "", 24)
+ _ = pdf.SetFont("Inter-Bold", "", 24)
pdf.SetTextColor(0, 0, 0)
_ = pdf.Cell(nil, title)
pdf.Br(36)
@@ -129,6 +129,9 @@ func writeTotal(pdf *gopdf.GoPdf, label string, total float64) {
pdf.SetTextColor(0, 0, 0)
_ = pdf.SetFontSize(12)
pdf.SetX(amountColumnOffset - 15)
+ if label == totalLabel {
+ _ = pdf.SetFont("Inter-Bold", "", 11.5)
+ }
_ = pdf.Cell(nil, currencySymbols[currency]+strconv.FormatFloat(total, 'f', 2, 64))
pdf.Br(24)
}