} return $diff; } function containt($c1, $c2) { return false; } $fileData = []; $result = []; $lastX = ''; $lastC = null; $chainBuilder = new \esee\ChainBuilder($points); foreach ($points as $y => $point) { foreach ($point as $x => $v) { if ($v == 1) { $c = $chainBuilder->makeChain2($x, $y); if (is_null($c)) { continue; } if (!is_null($lastC) && containt($lastC, $c)) { continue; } $lastC = $c; $str = join('', $c->path); //echo $str . "\n"; $length = strlen($str); if ($length < 2) { continue; } $file = $dir . '/data/' . $length . '.json'; if (file_exists($file)) {
$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); } } } foreach ($hashs as $length => $data) {