Closed decentral1se closed 9 months ago
Try this program, which uses TranslateRotate to change the origin to (250,250) (the middle of the canvas), and then rotate the text (now centered at the origin), 90 degrees. See also: https://speakerdeck.com/ajstarks/svgo-code-plus-picture-examples?slide=37
package main
import (
"os"
"github.com/ajstarks/svgo"
)
func main() {
canvas := svg.New(os.Stdout)
width := 500
height := 500
style := "font-size:48pt;fill:white;text-anchor:middle"
canvas.Start(width, height)
canvas.Rect(0,0,width,height)
canvas.Circle(250,250,10,"fill:red")
canvas.TranslateRotate(250,250,90)
canvas.Text(0,0, "hello, world", style)
canvas.Gend()
canvas.End()
}
Produces:
tysm @ajstarks :heart_decoration:
I am unsure whether to use
transform=rotate(...)
,TextPath
(only example I can find uses bezier which I don't need) orRotateTranslate
? Tried searching around for issues/examples but nothing that cleared it up for me. Just trying to do something like this: