SetDisplayMode('fullpage'); $mpdf->useSubstitutions = true; $mpdf->debug = true; $mpdf->simpleTables = true; if ($checkdir) { $ttfdir = $checkdir; } else { $ttfdir = _MPDF_TTFONTPATH; } $mqr=ini_get("magic_quotes_runtime"); if ($mqr) { set_magic_quotes_runtime(0); } if (!class_exists('TTFontFile_Analysis', false)) { include(_MPDF_PATH .'classes/ttfontsuni_analysis.php'); } //============================================================== $smp = true; $maxt = 131071; //============================================================== //============================================================== $unifile = file('UnicodeData.txt'); $unichars = array(); foreach($unifile AS $line) { if (preg_match('//',$line,$m)) { $rangename = ''; continue; } else if (preg_match('/^([12]{0,1}[0-9A-Za-z]{4});<(.*?), Last>/',$line,$m)) { if ($rangename && $rangename == $m[2]) { $endrange = hexdec($m[1]); for ($i=$startrange;$i<=$endrange; $i++) { $unichars[$i] = $i; } } $rangename = ''; } else if (preg_match('/^([12]{0,1}[0-9A-Za-z]{4});<(.*?), First>/',$line,$m)) { $startrange = hexdec($m[1]); $rangename = $m[2]; } else if (preg_match('/^([12]{0,1}[0-9A-Za-z]{4});/',$line,$m)) { $unichars[hexdec($m[1])] = hexdec($m[1]); $rangename = ''; } } // loads array $unicode_ranges include('UnicodeRanges.php'); //============================================================== $html = ''; //============================================================== $ff = scandir($ttfdir); $tempfontdata = array(); foreach($ff AS $f) { $ttf = new TTFontFile_Analysis(); $ret = array(); $isTTC = false; if (strtolower(substr($f,-4,4))=='.ttf' || strtolower(substr($f,-4,4))=='.otf') { $ret[] = $ttf->extractCoreInfo($ttfdir.$f); } for ($i=0; $i $ur) { if ($urk >= ($urgp*$ningroup) && $urk < (($urgp+1)*$ningroup)) { $rangekey = $urk; $range = $ur['range']; $rangestart = $ur['starthex']; $rangeend = $ur['endhex']; $html .= ''.strtoupper($range).' (U+'.$rangestart .'-U+'.$rangeend.')'; } } $html .= ''; foreach ($tempfontdata AS $fname => $v) { $cw = ''; if (file_exists((_MPDF_TTFONTDATAPATH.$fname.'.cw.dat'))) { $cw = file_get_contents(_MPDF_TTFONTDATAPATH.$fname.'.cw.dat'); } else { $mpdf->fontdata[$fname]['R'] = $tempfontdata[$fname]['file']; $mpdf->AddFont($fname); $cw = file_get_contents(_MPDF_TTFONTDATAPATH.$fname.'.cw.dat'); } if (!$cw) { continue; die("Font data not available for $fname"); } $counter=0; $max = $maxt; // create HTML content $html .= ''; $html .= ''.$fname.''; foreach($unicode_ranges AS $urk => $ur) { if ($urk >= ($urgp*$ningroup) && $urk < (($urgp+1)*$ningroup)) { if ($ur['pua'] || $ur['reserved'] || $ur['control']) { $html .= ''; } else { $rangekey = $urk; $range = $ur['range']; $rangestart = $ur['starthex']; $rangeend = $ur['endhex']; $rangestartdec = $ur['startdec']; $rangeenddec = $ur['enddec']; $uniinrange = 0; $fontinrange = 0; for ($i=$rangestartdec; $i<=$rangeenddec; $i++) { //if (isset($cw[$i])) { $fontinrange++; } if ($mpdf->_charDefined($cw, $i)) { $fontinrange++; } if (isset($unichars[$i])) { $uniinrange++; } } if ($uniinrange) { if ($fontinrange) { $pc = ($fontinrange/$uniinrange); $str = '('.$fontinrange.'/'.$uniinrange.')'; if ($pc==1) { $fullcovers[$urk][] = $fname; $html .= ''; } else if ($pc>1) { $fullcovers[$urk][] = $fname; $html .= ''.$str.''; } else if ($pc>=0.9) { $html .= ''.$str.''; $nearlycovers[$urk][] = $fname; } else if ($pc>0.75) { $html .= ''.$str.''; } else if ($pc>0.5) { $html .= ''.$str.''; } else if ($pc>0.25) { $html .= ''.$str.''; } else { $html .= ''.$str.''; } } else { $html .= '(0/0)'; } } else { $html .= ''; } } } } $html .= ''; } //============================================================== $html .= ''; } $html .= '

Fonts with full coverage of Unicode Ranges

'; $html .= ''; //$html .= ''; foreach($unicode_ranges AS $urk => $ur) { if ($ur['pua'] || $ur['reserved'] || $ur['control']) { continue; } $rangekey = $urk; $range = $ur['range']; $rangestart = $ur['starthex']; $rangeend = $ur['endhex']; $ext = $ext2 = ''; if ($ur['combining']) { $ext = 'background-color:#DDDDFF;'; $ext2 = '
Special positioning required'; } if ($ur['vertical']) { $ext = 'background-color:#FFDDDD;'; $ext2 = '
Vertical positioning required'; } if ($ur['special']) { $ext = 'background-color:#FFDDDD;'; $ext2 = '
Special processing required'; } $html .= ''; $arr = $fullcovers[$urk]; $narr = $nearlycovers[$urk]; if (is_array($arr)) { $html .= ''; } else if (is_array($narr)) { $html .= ''; } else { $html .= ''; } } $html.= '
'.strtoupper($range).' (U+'.$rangestart .'-U+'.$rangeend.')'.$ext2.''. implode(', ',$arr). '
'. implode(', ',$narr). ' (>90%)
'; //============================================================== echo $html; exit; //============================================================== //============================================================== //============================================================== //============================================================== ?>