]>
git.immae.eu Git - github/wallabag/wallabag.git/blob - inc/3rdparty/libraries/mpdf/utils/font_dump.php
4 This script prints out all characters in a TrueType font file
5 to a PDF document. Point your browser to
6 http://your.domain/your_path_to _mpdf/utils/font_dump.php
7 The font file must be located in /ttfonts/ (or the default font
8 directory defined by _MPDF_TTFONTPATH.
9 By default this will examine the font dejavusanscondensed.
10 You can optionally define an alternative font file to examine by setting
11 the variable below (must be a relative path, or filesystem path):
15 $font = 'dejavusanscondensed'; // Use internal mPDF font-name
17 $showmissing = true; // Show all missing unicode blocks / characters
20 //////////////////////////////////
21 //////////////////////////////////
22 //////////////////////////////////
25 ini_set("memory_limit","256M");
27 //==============================================================
28 //==============================================================
29 define('_MPDF_URI', '../');
30 include("../mpdf.php");
33 $mpdf->StartProgressBarOutput(2);
35 $mpdf->SetDisplayMode('fullpage');
37 $mpdf->useSubstitutions
= true;
39 $mpdf->simpleTables
= true;
40 // force fonts to be embedded whole i.e. NOT susbet
41 $mpdf->percentSubset
= 0;
43 //==============================================================
44 //==============================================================
45 //==============================================================
46 //==============================================================
48 // This generates a .mtx.php file if not already generated
49 $mpdf->WriteHTML('<style>td { border: 0.1mm solid #555555; } body { font-weight: normal; }</style>');
50 $mpdf->WriteHTML('<h3 style="font-family:'.$font.'">'.strtoupper($font).'</h3>'); // Separate Paragraphs defined by font
52 //==============================================================
53 //==============================================================
54 //==============================================================
55 //==============================================================
56 $unifile = file('UnicodeData.txt');
59 foreach($unifile AS $line) {
60 if ($smp && preg_match('/^(1[0-9A-Za-z]{4});/',$line,$m)) {
61 $unichars[hexdec($m[1])] = hexdec($m[1]);
63 else if (preg_match('/^([0-9A-Za-z]{4});/',$line,$m)) {
64 $unichars[hexdec($m[1])] = hexdec($m[1]);
68 // loads array $unicode_ranges
69 include('UnicodeRanges.php');
70 //==============================================================
71 //==============================================================
75 $cw = file_get_contents(_MPDF_TTFONTDATAPATH
.$font.'.cw.dat');
76 if (!$cw) { die("Error - Must be able to read font metrics file: "._MPDF_TTFONTDATAPATH
.$font
.'.cw.dat'); }
80 include(_MPDF_TTFONTDATAPATH
.$font.'.mtx.php');
90 $justfinishedblank = false;
91 $justfinishedblankinvalid = false;
93 foreach($unicode_ranges AS $urk => $ur) {
94 if (0 >= $ur['startdec'] && 0 <= $ur['enddec']) {
96 $range = $ur['range'];
97 $rangestart = $ur['starthex'];
98 $rangeend = $ur['endhex'];
102 $lastrange = $range ;
103 // create HTML content
104 $html .= '<table cellpadding="2" cellspacing="0" style="font-family:'.$font.';text-align:center; border-collapse: collapse; ">';
105 $html .= '<tr><td colspan="18" style="font-family:helvetica;font-weight:bold">'.strtoupper($font).'</td></tr>';
106 $html .= '<tr><td colspan="18" style="font-family:helvetica;font-size:8pt;font-weight:bold">'.strtoupper($range).' (U+'.$rangestart .'-U+'.$rangeend.')</td></tr>';
107 $html .= '<tr><td></td>';
109 $html .= '<td></td>';
110 for ($i = 0; $i < 16; $i++
) {
111 $html .= '<td><b>-'.sprintf('%X', $i).'</b></td>';
115 // print each character
116 for ($i = 32; $i < $max; ++
$i) {
117 if (($i > 0) AND (($i %
16) == 0)) {
119 while($notthisline) {
120 for ($j = 0; $j < 16; $j++
) {
121 if ($mpdf->_charDefined($cw, ($i +
$j))) {
122 //if (isset($cw[($i+$j)])) {
123 $notthisline = false;
129 foreach($unicode_ranges AS $urk => $ur) {
130 if ($i >= $ur['startdec'] && $i <= $ur['enddec']) {
132 $range = $ur['range'];
133 $rangestart = $ur['starthex'];
134 $rangeend = $ur['endhex'];
139 for ($j = 0; $j < 16; $j++
) {
140 if (isset($unichars[$i+
$j])) { $anyvalid
= true; break; }
142 if ($range && $range == $lastrange) {
144 if (!$justfinishedblankinvalid) {
145 $html .= '<tr><td colspan="18" style="background-color:#555555; font-size: 4pt;"> </td></tr>';
147 $justfinishedblankinvalid = true;
149 else if (!$justfinishedblank ) {
150 $html .= '<tr><td colspan="18" style="background-color:#FFAAAA; font-size: 4pt;"> </td></tr>';
151 $justfinishedblank = true;
155 $html .= '</tr></table><br />';
156 $mpdf->WriteHTML($html); $html = '';
157 $html .= '<table cellpadding="2" cellspacing="0" style="font-family:'.$font.';text-align:center; border-collapse: collapse; ">';
158 $html .= '<tr><td colspan="18" style="font-family:helvetica;font-size:8pt;font-weight:bold">'.strtoupper($range).' (U+'.$rangestart.'-U+'.$rangeend.')</td></tr>';
159 $html .= '<tr><td></td>';
160 $html .= '<td></td>';
161 for ($k = 0; $k < 16; $k++
) {
162 $html .= '<td><b>-'.sprintf('%X', $k).'</b></td>';
164 $justfinishedblank = false;
165 $justfinishedblankinvalid = false;
167 $lastrange = $range ;
170 if ($i > $max) { break 2; }
173 foreach($unicode_ranges AS $urk => $ur) {
174 if ($i >= $ur['startdec'] && $i <= $ur['enddec']) {
176 $range = $ur['range'];
177 $rangestart = $ur['starthex'];
178 $rangeend = $ur['endhex'];
183 if ($i > 0 && ($i %
16) == 0 && ($range != $lastrange)) {
184 $html .= '</tr></table><br />';
185 $mpdf->WriteHTML($html); $html = '';
186 $html .= '<table cellpadding="2" cellspacing="0" style="font-family:'.$font.';text-align:center; border-collapse: collapse; ">';
187 $html .= '<tr><td colspan="18" style="font-family:helvetica;font-size:8pt;font-weight:bold">'.strtoupper($range).' (U+'.$rangestart.'-U+'.$rangeend.')</td></tr>';
188 $html .= '<tr><td></td>';
189 $html .= '<td></td>';
190 for ($k = 0; $k < 16; $k++
) {
191 $html .= '<td><b>-'.sprintf('%X', $k).'</b></td>';
194 $lastrange = $range ;
195 $justfinishedblank = false;
196 $justfinishedblankinvalid = false;
197 $html .= '</tr><tr><td><i>'.(floor($i / 16)*16).'</i></td>';
198 $html .= '<td><b>'.sprintf('%03X', floor($i / 16)).'-</b></td>';
200 if ($mpdf->_charDefined($cw, $i)) { $html
.= '<td>&#'.$i
.';</td>'; $counter++
; }
201 else if (isset($unichars[$i])) { $html
.= '<td style="background-color: #FFAAAA;"></td>'; }
202 else { $html
.= '<td style="background-color: #555555;"></td>'; }
206 for ($j = ($i %
16); $j < 16; ++
$j) { $html
.= '<td style="background-color: #555555;"></td>'; }
208 $html .= '</tr></table><br />';
209 //==============================================================
210 //==============================================================
211 $mpdf->WriteHTML($html); // Separate Paragraphs defined by font
216 //==============================================================
217 //==============================================================
218 //==============================================================
219 //==============================================================