예제 #1
0
파일: learning.php 프로젝트: vench/esee
}
$c = new \esee\ChainBuilder([]);
foreach ($fonts as $font) {
    foreach ($chars as $char) {
        //6,7,8,
        $size = [9, 10, 11, 12, 13, 14, 15, 16, 18, 20, 22, 24];
        foreach ($size as $s) {
            $im = imagecreatetruecolor(40, 40);
            $white = imagecolorallocate($im, 0xff, 0xff, 0xff);
            $black = imagecolorallocate($im, 0x0, 0x0, 0x0);
            imagefill($im, 0, 0, $white);
            //echo $fontDir .  $font . "\n"; exit();
            imagefttext($im, $s, 0, 5, 30, $black, $fontDir . $font, $char);
            $points = getPoints($im, 40, 40);
            list($x, $y) = getFirst($points);
            $c->reset($points);
            $chain = $c->makeChain2($x, $y);
            //\esee\Helper::view2($chain);
            //print_r($chain->path);	//  exit();
            if (is_null($chain)) {
                //echo $char . ' '.  $font . "\n";
                //\esee\Helper::view($points); if($i > 3) exit();
                continue;
            }
            $hash = join('', $chain->path);
            $hashs[strlen($hash)][] = [$hash, $char];
            //imagepng($im, './images/'.md5($font). '_' .$char. '_' . $s . '.png');
            imagedestroy($im);
        }
    }
}