all repos — captcha @ 50fb09e8128e07ae0486e239b23e323657e26bda

Go package captcha implements generation and verification of image and audio CAPTCHAs.

font.go (view raw)

  1// Copyright 2011 Dmitry Chestnykh. All rights reserved.
  2// Use of this source code is governed by a MIT-style
  3// license that can be found in the LICENSE file.
  4
  5package captcha
  6
  7const (
  8	fontWidth  = 11
  9	fontHeight = 18
 10	blackChar  = 1
 11)
 12
 13var font = [][]byte{
 14	{ // 0
 15		0, 0, 0, 1, 1, 1, 1, 1, 0, 0, 0,
 16		0, 0, 1, 1, 1, 1, 1, 1, 1, 0, 0,
 17		0, 1, 1, 1, 0, 0, 0, 1, 1, 1, 0,
 18		0, 1, 1, 0, 0, 0, 0, 0, 1, 1, 0,
 19		1, 1, 1, 0, 0, 0, 0, 0, 1, 1, 0,
 20		1, 1, 0, 0, 0, 0, 0, 0, 0, 1, 1,
 21		1, 1, 0, 0, 0, 0, 0, 0, 0, 1, 1,
 22		1, 1, 0, 0, 0, 0, 0, 0, 0, 1, 1,
 23		1, 1, 0, 0, 0, 0, 0, 0, 0, 1, 1,
 24		1, 1, 0, 0, 0, 0, 0, 0, 0, 1, 1,
 25		1, 1, 0, 0, 0, 0, 0, 0, 0, 1, 1,
 26		1, 1, 0, 0, 0, 0, 0, 0, 0, 1, 1,
 27		1, 1, 0, 0, 0, 0, 0, 0, 0, 1, 1,
 28		1, 1, 0, 0, 0, 0, 0, 0, 1, 1, 1,
 29		0, 1, 1, 0, 0, 0, 0, 0, 1, 1, 0,
 30		0, 1, 1, 1, 0, 0, 0, 1, 1, 1, 0,
 31		0, 0, 1, 1, 1, 1, 1, 1, 1, 0, 0,
 32		0, 0, 0, 1, 1, 1, 1, 1, 0, 0, 0,
 33	},
 34	{ // 1
 35		0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0,
 36		0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0,
 37		0, 0, 0, 1, 1, 1, 1, 0, 0, 0, 0,
 38		0, 0, 1, 1, 1, 1, 1, 0, 0, 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