gg/examples/lorem.go

23 lines
774 B
Go
Raw Normal View History

2016-02-20 05:03:39 +01:00
package main
import "github.com/fogleman/gg"
2016-02-24 23:22:21 +01:00
var line = ("Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod" +
"tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam," +
"quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo" +
"consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse" +
"cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat" +
"non proident, sunt in culpa qui officia deserunt mollit anim id est laborum. ")
2016-02-20 05:03:39 +01:00
func main() {
const W = 800
const H = 400
dc := gg.NewContext(W, H)
dc.SetRGB(1, 1, 1)
dc.Clear()
dc.SetRGB(0, 0, 0)
2016-02-24 23:22:21 +01:00
dc.LoadFontFace("/Library/Fonts/Arial.ttf", 18)
dc.DrawStringWrapped(line, 20, 20, W-40)
2016-02-20 05:03:39 +01:00
dc.SavePNG("out.png")
}