mirror of
https://github.com/rls-moe/nyx
synced 2024-11-16 22:12:24 +00:00
215 lines
6.5 KiB
Go
215 lines
6.5 KiB
Go
// Copyright 2011 Dmitry Chestnykh. All rights reserved.
|
|
// Use of this source code is governed by a MIT-style
|
|
// license that can be found in the LICENSE file.
|
|
|
|
package captcha
|
|
|
|
const (
|
|
fontWidth = 11
|
|
fontHeight = 18
|
|
blackChar = 1
|
|
)
|
|
|
|
var font = [][]byte{
|
|
{ // 0
|
|
0, 0, 0, 1, 1, 1, 1, 1, 0, 0, 0,
|
|
0, 0, 1, 1, 1, 1, 1, 1, 1, 0, 0,
|
|
0, 1, 1, 1, 0, 0, 0, 1, 1, 1, 0,
|
|
0, 1, 1, 0, 0, 0, 0, 0, 1, 1, 0,
|
|
1, 1, 1, 0, 0, 0, 0, 0, 1, 1, 0,
|
|
1, 1, 0, 0, 0, 0, 0, 0, 0, 1, 1,
|
|
1, 1, 0, 0, 0, 0, 0, 0, 0, 1, 1,
|
|
1, 1, 0, 0, 0, 0, 0, 0, 0, 1, 1,
|
|
1, 1, 0, 0, 0, 0, 0, 0, 0, 1, 1,
|
|
1, 1, 0, 0, 0, 0, 0, 0, 0, 1, 1,
|
|
1, 1, 0, 0, 0, 0, 0, 0, 0, 1, 1,
|
|
1, 1, 0, 0, 0, 0, 0, 0, 0, 1, 1,
|
|
1, 1, 0, 0, 0, 0, 0, 0, 0, 1, 1,
|
|
1, 1, 0, 0, 0, 0, 0, 0, 1, 1, 1,
|
|
0, 1, 1, 0, 0, 0, 0, 0, 1, 1, 0,
|
|
0, 1, 1, 1, 0, 0, 0, 1, 1, 1, 0,
|
|
0, 0, 1, 1, 1, 1, 1, 1, 1, 0, 0,
|
|
0, 0, 0, 1, 1, 1, 1, 1, 0, 0, 0,
|
|
},
|
|
{ // 1
|
|
0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0,
|
|
0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0,
|
|
0, 0, 0, 1, 1, 1, 1, 0,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