faiface / pixel

A hand-crafted 2D game library in Go
MIT License
4.43k stars 244 forks source link

How to set text kerning? #311

Closed makarychev13 closed 1 year ago

makarychev13 commented 1 year ago

Hello. It is possible to set letter spacing? I mean analog letter-spacing.

Example code

func main() {
   ttf, err := loadTTF("Mariupol-Regular.ttf", 8) //function from doc
   if err != nil {
     log.Fatal(err)
   }

   atlas := text.NewAtlas(ttf, text.ASCII, text.RangeTable(unicode.Cyrillic))
   basicTxt := text.New(pixel.V(15, 175), atlas)
   basicTxt.SetKerning(2) //I want to use something similar, but I can't find it in the pixel or freetype/truetype
}