Example #1
0
func drawText(cr *cairo.Context, mf *Font, x, y int, fg, bg *Color, line string) {
	if bg != nil {
		setColor(cr, bg)
		cr.Rectangle(float64(x), float64(y),
			float64(len(line)*mf.cw), float64(mf.ch))
		cr.Fill()
	}

	cr.MoveTo(float64(x), float64(y+mf.ch-mf.descent))
	setColor(cr, fg)
	cr.ShowText(line)
}