From 104b764746036a97c1606e5bf3c38a0be5186934 Mon Sep 17 00:00:00 2001 From: Justin Hawkins Date: Tue, 28 Apr 2026 11:01:03 +0930 Subject: [PATCH] WIP --- .vscode/settings.json | 8 ++++++++ main.go | 26 +++----------------------- 2 files changed, 11 insertions(+), 23 deletions(-) create mode 100644 .vscode/settings.json diff --git a/.vscode/settings.json b/.vscode/settings.json new file mode 100644 index 0000000..cb355c4 --- /dev/null +++ b/.vscode/settings.json @@ -0,0 +1,8 @@ +{ + "cSpell.words": [ + "codeberg", + "fpdf", + "qrcode", + "yeqown" + ] +} \ No newline at end of file diff --git a/main.go b/main.go index 7795bab..0f6b7e7 100644 --- a/main.go +++ b/main.go @@ -12,7 +12,7 @@ import ( var cols = 4 var rows = 4 var qrSize = 50.0 -var fontSize = 16.0 // pts +var fontSize = 32.0 // pts var fontSizeMM = fontSize / 72 * 25.4 var text = "meow!" @@ -86,12 +86,6 @@ func main() { colWidth := pageWidth / float64(cols) rowHeight := pageHeight / float64(rows) - // qrRowRatio := qrSize / rowHeight - // qrColRatio := qrSize / colWidth - - // fmt.Printf("qr/row height ratio: %.2f\n", qrRowRatio) - // fmt.Printf("qr/col width ratio: %.2f\n", qrColRatio) - if textTopPadding+fontSizeMM+qrTopPadding+qrSize > rowHeight { slog.Warn("qr is too big for row") } @@ -109,13 +103,6 @@ func main() { topLeftX := colWidth * float64(colIdx) topLeftY := rowHeight * float64(rowIdx) - // if rowHeight*0.8 < float64(qrSize) { - // panic("row too small for qr") - // } - // if colWidth*0.6 < float64(qrSize) { - // panic("col too small for qr") - // } - // label at the top pdf.Text( topLeftX+colWidth/2-textWidth/2, @@ -125,18 +112,11 @@ func main() { // qr at the bottom pdf.ImageOptions("qr", - topLeftX+colWidth/2-qrSize/2, //+float64(dim)/2, // centre - topLeftY+textTopPadding+fontSizeMM+qrTopPadding, // centre, below text line + topLeftX+colWidth/2-qrSize/2, + topLeftY+textTopPadding+fontSizeMM+qrTopPadding, qrSize, qrSize, false, fpdf.ImageOptions{AllowNegativePosition: true}, 0, "") - // pdf.Image("qr", - // topLeftX+5, // centre - // topLeftY+float64(fontSize)*1.3, // centre - // float64(qrSize), - // float64(qrSize), - // false, "tp", 0, "") - } }