Ejemplo n.º 1
0
// RenderTo32Bit renders a string using the bitmapped font to a non-antialised
// string to a 32-bit buffer with the given color. It returns the width of the
// string.
func (s *Font) RenderTo32Bit(
	str string, col color.Color, x, y int, target gfx.Surface32Bit) (xAdvance float64) {
	col32 := target.MapColor(col)
	for _, ch := range str {
		if !s.valid(ch) {
			continue
		}

		g := s.glyphs[int(ch)-s.startChar]

		s.render32BitChar(ch, col32, x+int(xAdvance), y, target)

		xAdvance += float64(g.xAdvance)
	}
	return
}