SetDisplayMode('fullpage');
$mpdf->useSubstitutions = true;
$mpdf->simpleTables = true;
// force fonts to be embedded whole i.e. NOT susbet
$mpdf->percentSubset = 0;
//==============================================================
//==============================================================
//==============================================================
//==============================================================
// This generates a .mtx.php file if not already generated
$mpdf->WriteHTML('');
$mpdf->WriteHTML('
' . strtoupper($font) . '
'); // Separate Paragraphs defined by font
$html = '';
//==============================================================
//==============================================================
//==============================================================
//==============================================================
$unifile = file('UnicodeData.txt');
$unichars = array();
foreach ($unifile AS $line) {
if ($smp && preg_match('/^(1[0-9A-Za-z]{4});/', $line, $m)) {
$unichars[hexdec($m[1])] = hexdec($m[1]);
} else if (preg_match('/^([0-9A-Za-z]{4});/', $line, $m)) {
$unichars[hexdec($m[1])] = hexdec($m[1]);
}
}
// loads array $unicode_ranges
include('UnicodeRanges.php');
//==============================================================
//==============================================================
$cw = file_get_contents(_MPDF_TTFONTDATAPATH . $font . '.cw.dat');
if (!$cw) {
die("Error - Must be able to read font metrics file: " . _MPDF_TTFONTDATAPATH . $font . '.cw.dat');
}
$counter = 0;
include(_MPDF_TTFONTDATAPATH . $font . '.mtx.php');
if ($smp) {
$max = min($max, 131071);
} else {
$max = min($max, 65535);
}
$justfinishedblank = false;
$justfinishedblankinvalid = false;
foreach ($unicode_ranges AS $urk => $ur) {
if (0 >= $ur['startdec'] && 0 <= $ur['enddec']) {
$rangekey = $urk;
$range = $ur['range'];
$rangestart = $ur['starthex'];
$rangeend = $ur['endhex'];
break;
}
}
$lastrange = $range;
// create HTML content
$html .= '';
$html .= '| ' . strtoupper($font) . ' |
';
$html .= '| ' . strtoupper($range) . ' (U+' . $rangestart . '-U+' . $rangeend . ') |
';
$html .= ' | ';
$html .= ' | ';
for ($i = 0; $i < 16; $i++) {
$html .= '-' . sprintf('%X', $i) . ' | ';
}
// print each character
for ($i = $min; $i <= $max; ++$i) {
if (($i > 0) AND ( ($i % 16) == 0)) {
$notthisline = true;
while ($notthisline) {
for ($j = 0; $j < 16; $j++) {
if ($mpdf->_charDefined($cw, ($i + $j))) {
//if (isset($cw[($i+$j)])) {
$notthisline = false;
}
}
if ($notthisline) {
if ($showmissing) {
$range = '';
foreach ($unicode_ranges AS $urk => $ur) {
if ($i >= $ur['startdec'] && $i <= $ur['enddec']) {
$rangekey = $urk;
$range = $ur['range'];
$rangestart = $ur['starthex'];
$rangeend = $ur['endhex'];
break;
}
}
$anyvalid = false;
for ($j = 0; $j < 16; $j++) {
if (isset($unichars[$i + $j])) {
$anyvalid = true;
break;
}
}
if ($range && $range == $lastrange) {
if (!$anyvalid) {
if (!$justfinishedblankinvalid) {
$html .= '
| |
';
}
$justfinishedblankinvalid = true;
} else if (!$justfinishedblank) {
$html .= '| |
';
$justfinishedblank = true;
}
} else if ($range) {
$html .= '
';
$mpdf->WriteHTML($html);
$html = '';
$html .= '';
$html .= '| ' . strtoupper($range) . ' (U+' . $rangestart . '-U+' . $rangeend . ') |
';
$html .= ' | ';
$html .= ' | ';
for ($k = 0; $k < 16; $k++) {
$html .= '-' . sprintf('%X', $k) . ' | ';
}
$justfinishedblank = false;
$justfinishedblankinvalid = false;
}
$lastrange = $range;
}
$i += 16;
if ($i > $max) {
break 2;
}
}
}
foreach ($unicode_ranges AS $urk => $ur) {
if ($i >= $ur['startdec'] && $i <= $ur['enddec']) {
$rangekey = $urk;
$range = $ur['range'];
$rangestart = $ur['starthex'];
$rangeend = $ur['endhex'];
break;
}
}
if ($i > 0 && ($i % 16) == 0 && ($range != $lastrange)) {
$html .= '
';
$mpdf->WriteHTML($html);
$html = '';
$html .= '';
$html .= '| ' . strtoupper($range) . ' (U+' . $rangestart . '-U+' . $rangeend . ') |
';
$html .= ' | ';
$html .= ' | ';
for ($k = 0; $k < 16; $k++) {
$html .= '-' . sprintf('%X', $k) . ' | ';
}
}
$lastrange = $range;
$justfinishedblank = false;
$justfinishedblankinvalid = false;
$html .= '
| ' . (floor($i / 16) * 16) . ' | ';
$html .= '' . sprintf('%03X', floor($i / 16)) . '- | ';
}
// Add dotted circle to any character (mark) with width=0
if ($mpdf->_charDefined($cw, $i) && _getCharWidth($cw, $i) == 0) {
$html .= '◌' . $i . '; | ';
$counter++;
} else {
if ($mpdf->_charDefined($cw, $i)) {
$html .= '' . $i . '; | ';
$counter++;
} else if (isset($unichars[$i])) {
$html .= ' | ';
} else {
$html .= ' | ';
}
}
}
if (($i % 16) > 0) {
for ($j = ($i % 16); $j < 16; ++$j) {
$html .= ' | ';
}
}
$html .= '
';
//==============================================================
function _getCharWidth(&$cw, $u, $isdef = true) {
if ($u == 0) {
$w = false;
} else {
$w = (ord($cw[$u * 2]) << 8) + ord($cw[$u * 2 + 1]);
}
if ($w == 65535) {
return 0;
} else if ($w) {
return $w;
} else if ($isdef) {
return false;
} else {
return 0;
}
}
//==============================================================
$mpdf->WriteHTML($html); // Separate Paragraphs defined by font
$mpdf->Output();
exit;
//==============================================================
//==============================================================
//==============================================================
//==============================================================
?>