PluginProbe
PDF & Print by BestWebSoft – WordPress Posts and Pages PDF Generator Plugin / trunk
PDF & Print by BestWebSoft – WordPress Posts and Pages PDF Generator Plugin vtrunk
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
pdf-print / mpdf / utils / font_dump_OTL.php

font_dump_OTL.php in PDF & Print by BestWebSoft – WordPress Posts and Pages PDF Generator Plugin trunk, at mpdf/utils/font_dump_OTL.php

235 lines 6.4 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3
4
5 $family = 'khmeros';
6 //////////////////////////////////
7 $style = ''; // '','B','I','BI'; // At present only works for Regular style
8 //////////////////////////////////
9 //////////////////////////////////
10
11 $script = '';
12 $lang = '';
13 if (isset($_REQUEST['script'])) { $script = $_REQUEST['script']; }
14 if (isset($_REQUEST['lang'])) { $lang = $_REQUEST['lang']; }
15
16 if ($script && strlen($script )<4) { $script = str_pad($script , 4, ' '); }
17 if ($lang && strlen($lang)<4) { $lang = str_pad($lang, 4, ' '); }
18
19 //////////////////////////////////
20 //////////////////////////////////
21 //////////////////////////////////
22
23 set_time_limit(1200);
24 ini_set("memory_limit","512M");
25
26 //==============================================================
27 $overrideTTFFontRestriction = true;
28 //==============================================================
29 include("../mpdf.php");
30
31 $mpdf=new mPDF('');
32
33 $mpdf->simpleTables = true;
34
35 //==============================================================
36 // This generates a .mtx.php file if not already generated
37 $mpdf->SetFont($family,$style);
38 //==============================================================
39 //==============================================================
40 //==============================================================
41 //==============================================================
42 $ff = array();
43 $ffs = '';
44 if ($lang && $script) {
45 $GSUBFeatures = $mpdf->CurrentFont['GSUBFeatures'][$script][$lang];
46 if (is_array($GSUBFeatures)) {
47 foreach($GSUBFeatures AS $tag=>$v) {
48 $ff[] = '"'.$tag.'" 0';
49 }
50 }
51 $GPOSFeatures = $mpdf->CurrentFont['GPOSFeatures'][$script][$lang];
52 if (is_array($GPOSFeatures )) {
53 foreach($GPOSFeatures AS $tag=>$v) {
54 $ff[] = '"'.$tag.'" 0';
55 }
56 }
57 $ffs = implode(', ',$ff);
58 }
59 //==============================================================
60
61 $html = '
62 <style>
63 body {
64 font-family: DejaVuSansCondensed;
65 font-weight: normal;
66 font-size: 11pt;
67 font-feature-settings: '.$ffs.';
68 }
69 h5 {
70 font-size: 1rem;
71 color: #000066;
72 margin-bottom: 0.3em;
73 }
74 .glyphs {
75 font-family: '.$family.';
76 }
77 .subtable {
78 font-size: 0.7rem;
79 }
80 h5.level2 {
81 font-size: 0.85rem;
82 color: #6666AA;
83 }
84 .lookuptype {
85 font-size: 0.7rem;
86 color: #888888;
87 text-transform: uppercase;
88 }
89 .lookuptypesub {
90 font-size: 0.7rem;
91 color: #888888;
92 text-transform: uppercase;
93 }
94 span.unicode {
95 color: #888888;
96 font-size: 0.7rem;
97 }
98 span.changed {
99 font-family: '.$family.';
100 font-size: 1.5rem;
101 color: #FF4444;
102 font-feature-settings: '.$ffs.';
103 }
104 span.unchanged {
105 font-family: '.$family.';
106 font-size: 1.5rem;
107 color: #4444FF;
108 font-feature-settings: '.$ffs.';
109 }
110 span.backtrack {
111 font-family: '.$family.';
112 font-size: 1.5rem;
113 color: #66aa66;
114 font-feature-settings: '.$ffs.';
115 }
116 span.lookahead {
117 font-family: '.$family.';
118 font-size: 1.5rem;
119 color: #66aa66;
120 font-feature-settings: '.$ffs.';
121 }
122 span.inputother {
123 font-family: '.$family.';
124 font-size: 1.5rem;
125 color: #006688;
126 font-feature-settings: '.$ffs.';
127 }
128 div.context {
129 font-size: 0.7rem;
130 color: #888888;
131 text-transform: uppercase;
132 }
133 div.sequenceIndex {
134 font-size: 0.7rem;
135 }
136 div.rule {
137 font-size: 0.7rem;
138 }
139 .ignore {
140 color: #888888;
141 font-size: 0.7rem;
142 }
143 div.level2 {
144 margin-left: 5em;
145 }
146 </style>
147 <body>
148 <h1 style="text-align:center;">'.strtoupper($family.$style).'</h1>
149 ';
150
151 if ($lang && $script) {
152 $html .= '<h2 style="text-align:center;">'.$script.' '.$lang.'</h2>';
153 }
154 $mpdf->WriteHTML($html);
155 //==============================================================
156 //==============================================================
157 //==============================================================
158 //==============================================================
159 $mpdf->debugfonts = false;
160
161 $family = strtolower($family);
162 $style=strtoupper($style);
163 if($style=='IB') $style='BI';
164 $fontkey = $family.$style;
165 $stylekey = $style;
166 if (!$style) { $stylekey = 'R'; }
167
168 //==============================================================
169 $mpdf->overrideOTLsettings[$fontkey]['script'] = $script;
170 $mpdf->overrideOTLsettings[$fontkey]['lang'] = $lang;
171 //==============================================================
172
173
174 //include(_MPDF_TTFONTDATAPATH.$fontkey.'.mtx.php');
175
176 $ttffile = '';
177 if (defined('_MPDF_SYSTEM_TTFONTS')) {
178 $ttffile = _MPDF_SYSTEM_TTFONTS.$mpdf->fontdata[$family][$stylekey];
179 if (!file_exists($ttffile)) { $ttffile = ''; }
180 }
181 if (!$ttffile) {
182 $ttffile = _MPDF_TTFONTPATH.$mpdf->fontdata[$family][$stylekey];
183 if (!file_exists($ttffile)) { die("mPDF Error - cannot find TTF TrueType font file - ".$ttffile); }
184 }
185 $ttfstat = stat($ttffile);
186
187 if (isset($mpdf->fontdata[$family]['TTCfontID'][$stylekey])) { $TTCfontID = $mpdf->fontdata[$family]['TTCfontID'][$stylekey]; }
188 else { $TTCfontID = 0; }
189
190
191 $BMPonly = false;
192 if (in_array($family,$mpdf->BMPonly)) { $BMPonly = true; }
193 $useOTL = $mpdf->fontdata[$family]['useOTL'];
194 include(_MPDF_PATH .'classes/otl_dump.php');
195 $ttf = new OTLdump($mpdf);
196
197 $mpdf->OTLscript = $script;
198 $mpdf->OTLlang = $lang;
199
200 //==============================================================
201 //==============================================================
202 //==============================================================
203 //==============================================================
204 //==============================================================
205 //==============================================================
206 if($lang && $script) {
207
208 $ttf->getMetrics($ttffile, $fontkey, $TTCfontID, $mpdf->debugfonts, $BMPonly, true, $useOTL, 'detail');
209 }
210 //==============================================================
211 //==============================================================
212 //==============================================================
213 //==============================================================
214 else { // IF lang and script not defined
215
216 $ttf->getMetrics($ttffile, $fontkey, $TTCfontID, $mpdf->debugfonts, $BMPonly, true, $useOTL, 'summary');
217
218 }
219
220
221 //==============================================================
222 //==============================================================
223 //==============================================================
224 //==============================================================
225 //==============================================================
226 //==============================================================
227
228 $mpdf->Output();
229 exit;
230
231 //==============================================================
232 //==============================================================
233 //==============================================================
234 //==============================================================
235