Skip to content

Commit 6101047

Browse files
authored
Fix vertical centering
This makes text center vertically
1 parent 6f7e604 commit 6101047

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

text.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ func getImageWithText(text string, textColour color.Color, backgroundColour colo
4545
c.SetClip(dstImg.Bounds())
4646

4747
x := int((btnSize - width) / 2) // Horizontally centre text
48-
y := int(50 + (size / 3)) // Fudged vertical centre, erm, very "heuristic"
48+
y := int((float64(btnSize) / 2) + (size / 3)) // Fudged vertical centre, erm, very "heuristic"
4949

5050
pt := freetype.Pt(x, y)
5151
c.DrawString(text, pt)

0 commit comments

Comments
 (0)