click-captcha
Version:
Chinese Character Sequence Click Verification System
39 lines (38 loc) • 1.06 kB
TypeScript
import { RequiredCaptchaOptions, VerificationPoint } from "../types";
import * as opentype from "opentype.js";
export declare class SvgBuilder {
private static font;
private static hintFont;
/**
* 初始化字体
*/
static initializeFont(path: string): void;
/**
* 生成干扰线
*/
static generateNoiseLine(width: number, height: number): string;
/**
* 字符转路径
*/
static charToPath(fontFamily: opentype.Font | null, char: string, fontSize: number): {
path: string;
bbox: opentype.BoundingBox;
};
/**
* 生成文字路径
*/
static generateText(charData: {
path: string;
bbox: opentype.BoundingBox;
}, centerX: number, centerY: number): string;
/**
* 生成提示图片
*/
static buildHint(chars: Array<{
char: string;
}>, options: RequiredCaptchaOptions): string;
/**
* 生成完整的SVG
*/
static buildMain(chars: VerificationPoint[], options: RequiredCaptchaOptions): string;
}