Skip to content

Commit 7c2ffe7

Browse files
committed
[feature] demo of usage of Captcha.AddFontFromBytes
1 parent 07afb21 commit 7c2ffe7

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

examples/main.go

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,19 @@ func main() {
1818
panic(err.Error())
1919
}
2020

21+
/*
22+
//We can load font not only from localfile, but also from any []byte slice
23+
fontContenrs, err := ioutil.ReadFile("comic.ttf")
24+
if err != nil {
25+
panic(err.Error())
26+
}
27+
28+
err = cap.AddFontFromBytes(fontContenrs)
29+
if err != nil {
30+
panic(err.Error())
31+
}
32+
*/
33+
2134
cap.SetSize(128, 64)
2235
cap.SetDisturbance(captcha.MEDIUM)
2336
cap.SetFrontColor(color.RGBA{255, 255, 255, 255})

0 commit comments

Comments
 (0)