$pixX=getVal(@$opt['pxx'],1); $pixY=getVal(@$opt['pxy'],$pixX); $pointX=intval(@$opt['px'],0); $pointY=intval(@$opt['py'] ? $opt['py'] : $pointX); $chWi = getVal(@$opt['chw']); if ($chWi<1 or $chWi>8) Helpex(); $chHe = getVal(@$opt['chh'],$chWi); $chBase = intval(@$opt['first']); $numChars=getVal(@$opt['chars'],256); $cPage=getValS(@$opt['code'],'ASCII'); $fName=getValS(@$opt['name'],pathinfo($fileInput,PATHINFO_FILENAME)); $im = imagecreatefrompng($fileInput) or die("Immagine PNG RGB non valida `$fileInput`\n"); $noise = 0xFFFFFF; if (isset($opt['n'])) $noise=0xC0C0C0; if (isset($opt['o'])) ob_start(); echo "@CP $cPage\n"; echo "@FH $chHe\n"; echo "@FW $chWi\n"; echo "@MAX $numChars\n"; echo "@VER 2\n"; echo "@NAME $fName\n"; $chXx = intval(imagesx($im) / $chw); for ($cod = $chBase; $cod<$numChars;$cod++) { echo "@CH $cod ; ".dechex($cod)."\n";
$opt = getopt('ti:o:nN',array('pxx:','pxy:','chl:','tpl:','mktpl:')); if ($opt===false or count($opt)==0 or isset($opt['h'])) Helpex(); $div = isset($opt['n']); if (isset($opt['tpl'])) { $x= parse_ini_file($opt['tpl'],true) or die("Errore nel template `{$opt['tpl']}`\n"); if (!isset($x['font2img'])) die("Il file template deve iniziare con una riga [font2img] per essere vaildo.\n"); $x=$x['font2img']; unset($opt['tpl']); unset($x['tpl']); $opt=array_merge($opt,$x); $x=null; } $fileInput = getValS(@$opt['i']); $fileOutput = getValS(@$opt['o']); if (isset($opt['N'])) { $fileOutput = str_replace('*',pathinfo($fileInput,PATHINFO_FILENAME),$fileOutput); } $font = loadFont($fileInput); $font['width'] = $font['width'] ? $font['width'] : 8; $maxChar = $font['max']; $pixX=getVal(@$opt['pxx'],1); $pixY=getVal(@$opt['pxy'],$pixX); $charXLine = getVal(@$opt['chl'],16);