If I have font files (for different fonts), is it possible to create a caption over image using Go?
You can use my gofont library for that. See the documentation for the minimal interface.
You basically call gofont.LoadFromFile("font.ttf")
and on the returned Font
object, you can set the PixelHeight
and R/G/B
values to control the draw output.
Call font.Write()
on the object to render text into your draw.Image
. It is even possible to center text, using the returned x and y values returned by the function.
The library is pure Go and should work on all platforms.