text/text.go
func Draw(dst *ebiten.Image, text string, face font.Face, x, y int, clr color.Color) {
	textM.Lock()

	fx := fixed.I(x)
	prevR := rune(-1)

	runes := []rune(text)
	glyphImgs := getGlyphImages(face, runes)
	colorm := colorToColorM(clr)

	for i, r := range runes {
		if prevR >= 0 {
			fx += face.Kern(prevR, r)
		}
		drawGlyph(dst, face, r, glyphImgs[i], fx, fixed.I(y), colorm)
		fx += glyphAdvance(face, r)

		prevR = r
	}

	textM.Unlock()
}
func Draw(dst *ebiten.Image, text string, face font.Face, x, y int, clr color.Color) {
	textM.Lock()

	fx := fixed.I(x)
	prevR := rune(-1)

	runes := []rune(text)
	glyphImgs := getGlyphImages(face, runes)
	colorm := colorToColorM(clr)

	for i, r := range runes {
		if prevR >= 0 {
			fx += face.Kern(prevR, r)
		}
		drawGlyph(dst, face, r, glyphImgs[i], fx, fixed.I(y), colorm)
		fx += glyphAdvance(face, r)

		prevR = r
	}

	textM.Unlock()
}
func Draw ( dst * ebiten . Image , text string , face font . Face , x , y int , clr color . Color ) { textM . Lock ( ) fx := fixed . I ( x ) prevR := rune ( - 1 ) runes := [ ] rune ( text ) glyphImgs := getGlyphImages ( face , runes ) colorm := colorToColorM ( clr ) for i , r := range runes { if prevR >= 0 { fx += face . Kern ( prevR , r ) } drawGlyph ( dst , face , r , glyphImgs [ i ] , fx , fixed . I ( y ) , colorm ) fx += glyphAdvance ( face , r ) prevR = r } textM . Unlock ( ) }
// Draw draws a given text on a given destination image dst.
//
// face is the font for text rendering.
// (x, y) represents a 'dot' (period) position.
// Be careful that this doesn't represent left-upper corner position.
// clr is the color for text rendering.
//
// Glyphs used for rendering are cached in least-recently-used way.
// It is OK to call Draw with a same text and a same face at every frame in terms of performance.
//
// Be careful that the passed font face is held by this package and is never released.
// This is a known issue (#498).
//
// Draw is concurrent-safe.
Draw draws a given text on a given destination image dst . face is the font for text rendering . ( x y ) represents a dot ( period ) position . Be careful that this doesn t represent left - upper corner position . clr is the color for text rendering . Glyphs used for rendering are cached in least - recently - used way . It is OK to call Draw with a same text and a same face at every frame in terms of performance . Be careful that the passed font face is held by this package and is never released . This is a known issue ( #498 ) . Draw is concurrent - safe .