pixie/examples/text.nim
Simon Krauter 2ef52dc880
Extend example text.nim
Set the font color. (Did not find this in the documentation.)
2023-10-02 21:56:49 -03:00

14 lines
446 B
Nim

import pixie
let image = newImage(200, 200)
image.fill(rgba(255, 255, 255, 255))
var font = readFont("examples/data/Roboto-Regular_1.ttf")
font.size = 20
font.paint.color = color(1, 0, 0)
let text = "Typesetting is the arrangement and composition of text in graphic design and publishing in both digital and traditional medias."
image.fillText(font.typeset(text, vec2(180, 180)), translate(vec2(10, 10)))
image.writeFile("examples/text.png")