File tree Expand file tree Collapse file tree 1 file changed +4
-5
lines changed Expand file tree Collapse file tree 1 file changed +4
-5
lines changed Original file line number Diff line number Diff line change @@ -20,8 +20,6 @@ const (
20
20
fontsize = 120
21
21
linepadding = 32
22
22
dpi = 72
23
- offsetX = - 32 // it's off to the left so i'm just gonna fix it like this cuz i'm lazy LMAO
24
- offsetY = 0
25
23
maxLineWidth = 1800 // anything higher results in weirdness
26
24
)
27
25
@@ -71,17 +69,18 @@ func main() {
71
69
linelength := d .MeasureString (textsplit [i ] + word ).Round ()
72
70
if linelength >= maxLineWidth {
73
71
i ++
74
- textsplit = append (textsplit , "" )
72
+ textsplit = append (textsplit , word )
73
+ } else {
74
+ textsplit [i ] += " " + word
75
75
}
76
- textsplit [i ] += " " + word
77
76
}
78
77
// write the text to the image
79
78
lines := len (textsplit )
80
79
fmt .Printf ("Split into %d lines\n " , lines )
81
80
for line := 0 ; line < lines ; line ++ {
82
81
linelength := d .MeasureString (textsplit [line ]).Round ()
83
82
y := ((height - ((fontsize + linepadding ) * lines )) / 2 ) + ((fontsize + linepadding ) * (line + 1 )) - linepadding
84
- d .Dot = freetype .Pt ((width - linelength )/ 2 + offsetX , y + offsetY )
83
+ d .Dot = freetype .Pt ((width - linelength )/ 2 , y )
85
84
d .DrawString (textsplit [line ])
86
85
}
87
86
// write image to disk
You can’t perform that action at this time.
0 commit comments