gg/examples/text.go
Michael Fogleman 0fd2b0f764 fontHeight
2016-02-19 14:03:52 -05:00

21 lines
339 B
Go

package main
import (
"fmt"
"github.com/fogleman/gg"
)
func main() {
dc := gg.NewContext(1000, 1000)
dc.SetRGB(1, 1, 1)
dc.Clear()
dc.SetRGB(0, 0, 0)
dc.LoadFontFace("/Library/Fonts/Arial.ttf", 96)
s := "Hello, world!"
w, h := dc.MeasureString(s)
fmt.Println(w, h)
dc.DrawString(500-w/2, 500+h/2, s)
dc.SavePNG("out.png")
}