You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
You can use Scale/ScaleAbout but if you scale it too much the text might become pixelated.
(Choosing a bigger font size and scaling it down as opposed to up might avoid that)
Now, if you want to load the font face once and change the font size later, I don't think that's possible.
The best you can do is read the font file once and define the font faces with the different sizes manually.
This code should work but I didn't test it:
(Edit: it seems that SetFontFace is currently broken/gives different results from LoadFontFace. see #76)
// read font filefontBytes, err:=ioutil.ReadFile(fontFilePath)
iferr!=nil {
// handle error
}
// parse fontf, err:=truetype.Parse(fontBytes)
iferr!=nil {
// handle error
}
// define new font face and set it on the contextdc.SetFontFace(truetype.NewFace(f, &truetype.Options{Size: 60}))
dc.DrawString("big", 0, 0)
// again, but with a different sizedc.SetFontFace(truetype.NewFace(f, &truetype.Options{Size: 30}))
dc.DrawString("small", 0, 0)
No description provided.
The text was updated successfully, but these errors were encountered: