PluginProbe
PDF & Print by BestWebSoft – WordPress Posts and Pages PDF Generator Plugin / 1.5
PDF & Print by BestWebSoft – WordPress Posts and Pages PDF Generator Plugin v1.5
trunk 1.5 1.6 1.7 1.7.1 1.7.2 1.7.3 1.7.4 1.7.5 1.7.6 1.7.7 1.7.8 1.7.9 1.8.0 1.8.1 1.8.2 1.8.3 1.8.4 1.8.5 1.8.6 1.8.7 1.8.8 1.8.9 1.9.0 1.9.1 All 71 releases
← All changes | mpdf/utils/font_dump.php +220 -231 trunk1.5 View file →
@@ -1,231 +1,220 @@
1 -<?php
2 -
3 -/*
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):
12 -*/
13 -
14 -
15 -$font = 'dejavusanscondensed'; // Use internal mPDF font-name
16 -
17 -$min = 0x0020; // Minimum Unicode value to show
18 -$max = 0x2FFFF; // Maximum Unicode value to show
19 -
20 -$showmissing = false; // Show all missing unicode blocks / characters
21 -
22 -
23 -//////////////////////////////////
24 -//////////////////////////////////
25 -//////////////////////////////////
26 -
27 -set_time_limit(600);
28 -ini_set("memory_limit","512M");
29 -
30 -//==============================================================
31 -//==============================================================
32 -include("../mpdf.php");
33 -
34 -$mpdf=new mPDF('');
35 -
36 -$mpdf->SetDisplayMode('fullpage');
37 -
38 -$mpdf->useSubstitutions = true;
39 -$mpdf->simpleTables = true;
40 -// force fonts to be embedded whole i.e. NOT susbet
41 -$mpdf->percentSubset = 0;
42 -
43 -//==============================================================
44 -//==============================================================
45 -//==============================================================
46 -//==============================================================
47 -
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
51 -$html = '';
52 -//==============================================================
53 -//==============================================================
54 -//==============================================================
55 -//==============================================================
56 -$unifile = file('UnicodeData.txt');
57 -$unichars = array();
58 -
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]);
62 - }
63 - else if (preg_match('/^([0-9A-Za-z]{4});/',$line,$m)) {
64 - $unichars[hexdec($m[1])] = hexdec($m[1]);
65 - }
66 -}
67 -
68 -// loads array $unicode_ranges
69 -include('UnicodeRanges.php');
70 -//==============================================================
71 -//==============================================================
72 -
73 -
74 -
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'); }
77 -$counter=0;
78 -
79 -
80 -include(_MPDF_TTFONTDATAPATH.$font.'.mtx.php');
81 -
82 -if ($smp) {
83 - $max = min($max,131071);
84 -} else {
85 - $max = min($max,65535);
86 -}
87 -
88 -
89 -$justfinishedblank = false;
90 -$justfinishedblankinvalid = false;
91 -
92 - foreach($unicode_ranges AS $urk => $ur) {
93 - if (0 >= $ur['startdec'] && 0 <= $ur['enddec']) {
94 - $rangekey = $urk;
95 - $range = $ur['range'];
96 - $rangestart = $ur['starthex'];
97 - $rangeend = $ur['endhex'];
98 - break;
99 - }
100 - }
101 - $lastrange = $range ;
102 - // create HTML content
103 - $html .= '<table cellpadding="2" cellspacing="0" style="font-family:'.$font.';text-align:center; border-collapse: collapse; ">';
104 - $html .= '<tr><td colspan="18" style="font-family:dejavusanscondensed;font-weight:bold">'.strtoupper($font).'</td></tr>';
105 - $html .= '<tr><td colspan="18" style="font-family:dejavusanscondensed;font-size:8pt;font-weight:bold">'.strtoupper($range).' (U+'.$rangestart .'-U+'.$rangeend.')</td></tr>';
106 - $html .= '<tr><td></td>';
107 -
108 - $html .= '<td></td>';
109 - for ($i = 0; $i < 16; $i++) {
110 - $html .= '<td><b>-'.sprintf('%X', $i).'</b></td>';
111 - }
112 -
113 -
114 - // print each character
115 - for ($i = $min; $i <= $max; ++$i) {
116 - if (($i > 0) AND (($i % 16) == 0)) {
117 - $notthisline = true;
118 - while($notthisline) {
119 - for ($j = 0; $j < 16; $j++) {
120 - if ($mpdf->_charDefined($cw, ($i + $j))) {
121 - //if (isset($cw[($i+$j)])) {
122 - $notthisline = false;
123 - }
124 - }
125 - if ($notthisline) {
126 - if ($showmissing) {
127 - $range = '';
128 - foreach($unicode_ranges AS $urk => $ur) {
129 - if ($i >= $ur['startdec'] && $i <= $ur['enddec']) {
130 - $rangekey = $urk;
131 - $range = $ur['range'];
132 - $rangestart = $ur['starthex'];
133 - $rangeend = $ur['endhex'];
134 - break;
135 - }
136 - }
137 - $anyvalid = false;
138 - for ($j = 0; $j < 16; $j++) {
139 - if (isset($unichars[$i+$j])) { $anyvalid = true; break; }
140 - }
141 - if ($range && $range == $lastrange) {
142 - if (!$anyvalid) {
143 - if (!$justfinishedblankinvalid) {
144 - $html .= '<tr><td colspan="18" style="background-color:#555555; font-size: 4pt;">&nbsp;</td></tr>';
145 - }
146 - $justfinishedblankinvalid = true;
147 - }
148 - else if (!$justfinishedblank ) {
149 - $html .= '<tr><td colspan="18" style="background-color:#FFAAAA; font-size: 4pt;">&nbsp;</td></tr>';
150 - $justfinishedblank = true;
151 - }
152 - }
153 - else if($range) {
154 - $html .= '</tr></table><br />';
155 - $mpdf->WriteHTML($html); $html = '';
156 - $html .= '<table cellpadding="2" cellspacing="0" style="font-family:'.$font.';text-align:center; border-collapse: collapse; ">';
157 - $html .= '<tr><td colspan="18" style="font-family:dejavusanscondensed;font-size:8pt;font-weight:bold">'.strtoupper($range).' (U+'.$rangestart.'-U+'.$rangeend.')</td></tr>';
158 - $html .= '<tr><td></td>';
159 - $html .= '<td></td>';
160 - for ($k = 0; $k < 16; $k++) {
161 - $html .= '<td><b>-'.sprintf('%X', $k).'</b></td>';
162 - }
163 - $justfinishedblank = false;
164 - $justfinishedblankinvalid = false;
165 - }
166 - $lastrange = $range ;
167 - }
168 - $i +=16;
169 - if ($i > $max) { break 2; }
170 - }
171 - }
172 - foreach($unicode_ranges AS $urk => $ur) {
173 - if ($i >= $ur['startdec'] && $i <= $ur['enddec']) {
174 - $rangekey = $urk;
175 - $range = $ur['range'];
176 - $rangestart = $ur['starthex'];
177 - $rangeend = $ur['endhex'];
178 - break;
179 - }
180 - }
181 -
182 - if ($i > 0 && ($i % 16) == 0 && ($range != $lastrange)) {
183 - $html .= '</tr></table><br />';
184 - $mpdf->WriteHTML($html); $html = '';
185 - $html .= '<table cellpadding="2" cellspacing="0" style="font-family:'.$font.';text-align:center; border-collapse: collapse; ">';
186 - $html .= '<tr><td colspan="18" style="font-family:dejavusanscondensed;font-size:8pt;font-weight:bold">'.strtoupper($range).' (U+'.$rangestart.'-U+'.$rangeend.')</td></tr>';
187 - $html .= '<tr><td></td>';
188 - $html .= '<td></td>';
189 - for ($k = 0; $k < 16; $k++) {
190 - $html .= '<td><b>-'.sprintf('%X', $k).'</b></td>';
191 - }
192 - }
193 - $lastrange = $range ;
194 - $justfinishedblank = false;
195 - $justfinishedblankinvalid = false;
196 - $html .= '</tr><tr><td><i>'.(floor($i / 16)*16).'</i></td>';
197 - $html .= '<td><b>'.sprintf('%03X', floor($i / 16)).'-</b></td>';
198 - }
199 -
200 - // Add dotted circle to any character (mark) with width=0
201 - if ($mpdf->_charDefined($cw, $i) && _getCharWidth($cw, $i)==0) { $html .= '<td>&#x25cc;&#'.$i.';</td>'; $counter++; }
202 - else {
203 - if ($mpdf->_charDefined($cw, $i)) { $html .= '<td>&#'.$i.';</td>'; $counter++; }
204 - else if (isset($unichars[$i])) { $html .= '<td style="background-color: #FFAAAA;"></td>'; }
205 - else { $html .= '<td style="background-color: #555555;"></td>'; }
206 - }
207 - }
208 -
209 - if (($i % 16) > 0) {
210 - for ($j = ($i % 16); $j < 16; ++$j) { $html .= '<td style="background-color: #555555;"></td>'; }
211 - }
212 - $html .= '</tr></table><br />';
213 -//==============================================================
214 -function _getCharWidth(&$cw, $u, $isdef=true) {
215 - if ($u==0) { $w = false; }
216 - else { $w = (ord($cw[$u*2]) << 8) + ord($cw[$u*2+1]); }
217 - if ($w == 65535) { return 0; }
218 - else if ($w) { return $w; }
219 - else if ($isdef) { return false; }
220 - else { return 0; }
221 -}
222 -//==============================================================
223 -$mpdf->WriteHTML($html); // Separate Paragraphs defined by font
224 -
225 -$mpdf->Output();
226 -exit;
227 -
228 -//==============================================================
229 -//==============================================================
230 -//==============================================================
231 -//==============================================================
1 +<?php
2 +
3 +/*
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):
12 +*/
13 +
14 +
15 +$font = 'dejavusanscondensed'; // Use internal mPDF font-name
16 +
17 +$showmissing = true; // Show all missing unicode blocks / characters
18 +
19 +
20 +//////////////////////////////////
21 +//////////////////////////////////
22 +//////////////////////////////////
23 +
24 +set_time_limit(600);
25 +ini_set("memory_limit","256M");
26 +
27 +//==============================================================
28 +//==============================================================
29 +define('_MPDF_URI', '../');
30 +include("../mpdf.php");
31 +
32 +$mpdf=new mPDF('');
33 +$mpdf->StartProgressBarOutput(2);
34 +
35 +$mpdf->SetDisplayMode('fullpage');
36 +
37 +$mpdf->useSubstitutions = false;
38 +$mpdf->debug = true;
39 +$mpdf->simpleTables = true;
40 +
41 +//==============================================================
42 +//==============================================================
43 +//==============================================================
44 +//==============================================================
45 +
46 +// This generates a .mtx.php file if not already generated
47 +$mpdf->WriteHTML('<style>td { border: 0.1mm solid #555555; } body { font-weight: normal; }</style>');
48 +$mpdf->WriteHTML('<h3 style="font-family:'.$font.'">'.strtoupper($font).'</h3>'); // Separate Paragraphs defined by font
49 +$html = '';
50 +//==============================================================
51 +//==============================================================
52 +//==============================================================
53 +//==============================================================
54 +$unifile = file('UnicodeData.txt');
55 +$unichars = array();
56 +
57 +foreach($unifile AS $line) {
58 + if ($smp && preg_match('/^(1[0-9A-Za-z]{4});/',$line,$m)) {
59 + $unichars[hexdec($m[1])] = hexdec($m[1]);
60 + }
61 + else if (preg_match('/^([0-9A-Za-z]{4});/',$line,$m)) {
62 + $unichars[hexdec($m[1])] = hexdec($m[1]);
63 + }
64 +}
65 +
66 +// loads array $unicode_ranges
67 +include('UnicodeRanges.php');
68 +//==============================================================
69 +//==============================================================
70 +
71 +
72 +
73 +$cw = file_get_contents(_MPDF_TTFONTDATAPATH.$font.'.cw.dat');
74 +if (!$cw) { die("Error - Must be able to read font metrics file: "._MPDF_TTFONTDATAPATH.$font.'.cw.dat'); }
75 +$counter=0;
76 +
77 +
78 +include(_MPDF_TTFONTDATAPATH.$font.'.mtx.php');
79 +
80 +if ($smp) {
81 + $max = 131071;
82 +}
83 +else {
84 + $max = 65535;
85 +}
86 +
87 +
88 +$justfinishedblank = false;
89 +$justfinishedblankinvalid = false;
90 +
91 + foreach($unicode_ranges AS $urk => $ur) {
92 + if (0 >= $ur['startdec'] && 0 <= $ur['enddec']) {
93 + $rangekey = $urk;
94 + $range = $ur['range'];
95 + $rangestart = $ur['starthex'];
96 + $rangeend = $ur['endhex'];
97 + break;
98 + }
99 + }
100 + $lastrange = $range ;
101 + // create HTML content
102 + $html .= '<table cellpadding="2" cellspacing="0" style="font-family:'.$font.';text-align:center; border-collapse: collapse; ">';
103 + $html .= '<tr><td colspan="18" style="font-family:helvetica;font-weight:bold">'.strtoupper($font).'</td></tr>';
104 + $html .= '<tr><td colspan="18" style="font-family:helvetica;font-size:8pt;font-weight:bold">'.strtoupper($range).' (U+'.$rangestart .'-U+'.$rangeend.')</td></tr>';
105 + $html .= '<tr><td></td>';
106 +
107 + $html .= '<td></td>';
108 + for ($i = 0; $i < 16; $i++) {
109 + $html .= '<td><b>-'.sprintf('%X', $i).'</b></td>';
110 + }
111 +
112 +
113 + // print each character
114 + for ($i = 32; $i < $max; ++$i) {
115 + if (($i > 0) AND (($i % 16) == 0)) {
116 + $notthisline = true;
117 + while($notthisline) {
118 + for ($j = 0; $j < 16; $j++) {
119 + if ($mpdf->_charDefined($cw, ($i + $j))) {
120 + //if (isset($cw[($i+$j)])) {
121 + $notthisline = false;
122 + }
123 + }
124 + if ($notthisline) {
125 + if ($showmissing) {
126 + $range = '';
127 + foreach($unicode_ranges AS $urk => $ur) {
128 + if ($i >= $ur['startdec'] && $i <= $ur['enddec']) {
129 + $rangekey = $urk;
130 + $range = $ur['range'];
131 + $rangestart = $ur['starthex'];
132 + $rangeend = $ur['endhex'];
133 + break;
134 + }
135 + }
136 + $anyvalid = false;
137 + for ($j = 0; $j < 16; $j++) {
138 + if (isset($unichars[$i+$j])) { $anyvalid = true; break; }
139 + }
140 + if ($range && $range == $lastrange) {
141 + if (!$anyvalid) {
142 + if (!$justfinishedblankinvalid) {
143 + $html .= '<tr><td colspan="18" style="background-color:#555555; font-size: 4pt;">&nbsp;</td></tr>';
144 + }
145 + $justfinishedblankinvalid = true;
146 + }
147 + else if (!$justfinishedblank ) {
148 + $html .= '<tr><td colspan="18" style="background-color:#FFAAAA; font-size: 4pt;">&nbsp;</td></tr>';
149 + $justfinishedblank = true;
150 + }
151 + }
152 + else if($range) {
153 + $html .= '</tr></table><br />';
154 + $mpdf->WriteHTML($html); $html = '';
155 + $html .= '<table cellpadding="2" cellspacing="0" style="font-family:'.$font.';text-align:center; border-collapse: collapse; ">';
156 + $html .= '<tr><td colspan="18" style="font-family:helvetica;font-size:8pt;font-weight:bold">'.strtoupper($range).' (U+'.$rangestart.'-U+'.$rangeend.')</td></tr>';
157 + $html .= '<tr><td></td>';
158 + $html .= '<td></td>';
159 + for ($k = 0; $k < 16; $k++) {
160 + $html .= '<td><b>-'.sprintf('%X', $k).'</b></td>';
161 + }
162 + $justfinishedblank = false;
163 + $justfinishedblankinvalid = false;
164 + }
165 + $lastrange = $range ;
166 + }
167 + $i +=16;
168 + if ($i > $max) { break 2; }
169 + }
170 + }
171 + foreach($unicode_ranges AS $urk => $ur) {
172 + if ($i >= $ur['startdec'] && $i <= $ur['enddec']) {
173 + $rangekey = $urk;
174 + $range = $ur['range'];
175 + $rangestart = $ur['starthex'];
176 + $rangeend = $ur['endhex'];
177 + break;
178 + }
179 + }
180 +
181 + if ($i > 0 && ($i % 16) == 0 && ($range != $lastrange)) {
182 + $html .= '</tr></table><br />';
183 + $mpdf->WriteHTML($html); $html = '';
184 + $html .= '<table cellpadding="2" cellspacing="0" style="font-family:'.$font.';text-align:center; border-collapse: collapse; ">';
185 + $html .= '<tr><td colspan="18" style="font-family:helvetica;font-size:8pt;font-weight:bold">'.strtoupper($range).' (U+'.$rangestart.'-U+'.$rangeend.')</td></tr>';
186 + $html .= '<tr><td></td>';
187 + $html .= '<td></td>';
188 + for ($k = 0; $k < 16; $k++) {
189 + $html .= '<td><b>-'.sprintf('%X', $k).'</b></td>';
190 + }
191 + }
192 + $lastrange = $range ;
193 + $justfinishedblank = false;
194 + $justfinishedblankinvalid = false;
195 + $html .= '</tr><tr><td><i>'.(floor($i / 16)*16).'</i></td>';
196 + $html .= '<td><b>'.sprintf('%03X', floor($i / 16)).'-</b></td>';
197 + }
198 + if ($mpdf->_charDefined($cw, $i)) { $html .= '<td>&#'.$i.';</td>'; $counter++; }
199 + else if (isset($unichars[$i])) { $html .= '<td style="background-color: #FFAAAA;"></td>'; }
200 + else { $html .= '<td style="background-color: #555555;"></td>'; }
201 + }
202 +
203 + if (($i % 16) > 0) {
204 + for ($j = ($i % 16); $j < 16; ++$j) { $html .= '<td style="background-color: #555555;"></td>'; }
205 + }
206 + $html .= '</tr></table><br />';
207 +//==============================================================
208 +//==============================================================
209 +$mpdf->WriteHTML($html); // Separate Paragraphs defined by font
210 +
211 +$mpdf->Output();
212 +exit;
213 +
214 +//==============================================================
215 +//==============================================================
216 +//==============================================================
217 +//==============================================================
218 +
219 +
220 +?>