faiface / pixel

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

Ability to change not only color but font face when writing to a single text object #271

Open 3ter opened 3 years ago

3ter commented 3 years ago

As shown in the example it's possible to write to the same text object with different colors.

basicTxt.Color = colornames.Red
fmt.Fprintln(basicTxt, "Hello, text!")

basicTxt.Color = colornames.Green
fmt.Fprintln(basicTxt, "I support multiple lines!")

basicTxt.Color = colornames.Blue
fmt.Fprintf(basicTxt, "And I'm an %s, yay!", "io.Writer")

Could the same be done with the font face to change the size or font-weigth?

The workaround for me is to create separate text objects (which is a little bit more effort in terms of aligning those letters properly).