a41f938cec
As we have seen, dependencies version can prevent the build. We should user lock versions on dependencies that we know work: * Packages are vendored * Add Godep support * Added addtional install step in readme * Fix travis build error
214 lignes
6,5 Kio
Go
214 lignes
6,5 Kio
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,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