예제 #1
0
    ob_start();
    foreach ($FONTINFOSTRUCT as $k => $v) {
        $id = $v[0];
        $cmd = $v[2];
        if ($cmd == '@CHR' and isset($font['map']) and is_array($font['map']) and count($font['map']) > 0) {
            foreach ($font['map'] as $km => $vm) {
                echo "@CHR {$km} U" . wordwrap(bin2hex($vm), 4, '-U', true) . "\n";
            }
            continue;
        }
        if (isset($font[$id])) {
            echo $cmd . ' ' . $font[$id] . "\n";
        }
    }
    for ($a = 0; $a < $font['max']; $a++) {
        $map = charBmp($font, $a);
        showChar($map, $a);
    }
    file_put_contents($par['o'], ob_get_clean());
    exit;
}
if (isset($par['u'])) {
    $txt = file($par['u']) or die("\nErrore nel file di testo!\n");
    $font = array('ver' => 1, 'charset' => 'CP437', 'max' => 256, 'height' => 8, 'font' => null);
    $fontHeight = 8;
    if (isset($par['h']) and $par['h'] == 8) {
        $font['height'] = 8;
    }
    if (isset($par['h']) and $par['h'] == 16) {
        $font['height'] = 16;
    }
예제 #2
0
$pal[0] = imagecolorallocate($im,0,0,0);
$pal[1] = imagecolorallocate($im,255,255,255);
if ($div) {
	$pal[2] = imagecolorallocate($im,0x20,0,0);
	$chbW = $pixX*$font['width'];
	$chbH = $pixY*$font['height'];
	$chbWf = $chbW+$pixX-1;
	$chbHf = $chbH+$pixY-1;
}
	
$FW = $div ? 1 + $font['width'] : $font['width'];
$FH = $div ? 1 + $font['height'] : $font['height'];

$cod = 0;
for ($cy = 0; $cy<$imgHC;$cy++) {
	for ($cx = 0; $cx<$charXLine; $cx++) {
		$x0 = $cx*$pixX*$FW;
		$y0 = $cy*$pixY*$FH;
		if ($div) {
			imagefilledrectangle($im,$x0+$chbW,$y0,$x0+$chbWf,$y0+$chbHf,$pal[2]);
			imagefilledrectangle($im,$x0,$y0+$chbH,$x0+$chbWf,$y0+$chbHf,$pal[2]);
			}
		charBmp($im,$x0,$y0,$pal,$pixX,$pixY,$font,$cod);
		if ($cod++>$font['max']) break;
		}
	if ($cod>$font['max']) break;
	}

imagepng($im,$fileOutput) or die("Non riesco a salvare `$fileOuptut`\n");
$font=null;
?>
예제 #3
0
        $out[] = $ch;
    }
    $text = $out;
}
$j = count($text) + 1;
// Tipico ciclo for per convertire la stringa.
$FW = $font['width'] ? $font['width'] : 8;
for ($i = 1; $i < $j; $i++) {
    if ($fMod) {
        $id = '@' . str_pad(dechex($text[$i]), 4, '0', STR_PAD_LEFT);
        if (isset($font['map'][$id])) {
            $t0 = unpack('n', $map[$id]);
            $text[$i] = $t0[1];
        }
    }
    addBmp($map, charBmp($font, $text[$i]), $FW);
    // Aggiungi ogni bitmap di ogni carattere alla bitmap finale.
}
$imgWidth = count($map);
// Trova la larghezza della bitmap.
if (@$par['freq'] and $listChannels) {
    // Ricarica le frequenze se c'è listChannel attivato.
    $lst = file($par['freq']) or die("Errore nel file delle frequenze.\n");
    $frx = array();
    foreach ($lst as $num => $li) {
        $li = str_replace("\t", ' ', $li);
        $li = trim($li, "\t\r\n ");
        list($li) = explode(';', $li, 2);
        if ($li == '') {
            continue;
        }