PluginProbe ʕ •ᴥ•ʔ
GiveWP – Donation Plugin and Fundraising Platform / 2.10.4
GiveWP – Donation Plugin and Fundraising Platform v2.10.4
4.16.3 4.16.2 4.16.1 4.16.0 4.15.5 4.15.4 4.15.3 4.15.2 4.15.1 4.15.0 2.3.0 2.3.1 2.3.2 2.30.0 2.31.0 2.31.1 2.32.0 2.33.0 2.33.1 2.33.2 2.33.3 2.33.4 2.33.5 2.4.0 2.4.1 2.4.2 2.4.3 2.4.4 2.4.5 2.4.6 2.4.7 2.5.0 2.5.1 2.5.10 2.5.11 2.5.12 2.5.13 2.5.2 2.5.3 2.5.4 2.5.5 2.5.6 2.5.7 2.5.8 2.5.9 2.6.0 2.6.1 2.6.2 2.6.3 2.7.0 2.7.1 2.7.2 2.7.3 2.7.4 2.7.5 2.8.0 2.8.1 2.9.0 2.9.1 2.9.2 2.9.3 2.9.4 2.9.5 2.9.6 2.9.7 3.0.0 3.0.1 3.0.2 3.0.3 3.0.4 3.1.0 3.1.1 3.1.2 3.10.0 3.11.0 3.12.0 3.12.1 3.12.2 3.12.3 3.13.0 3.14.0 3.14.1 3.14.2 3.15.0 3.15.1 3.16.0 3.16.1 3.16.2 3.16.3 3.16.4 3.16.5 3.17.0 3.17.1 3.17.2 3.18.0 3.19.0 3.19.1 3.19.2 3.19.3 3.19.4 3.2.0 3.2.1 3.2.2 3.20.0 3.21.0 3.21.1 3.22.0 3.22.1 3.22.2 3.3.0 3.3.1 3.4.0 3.4.1 3.4.2 3.5.0 3.5.1 3.6.0 3.6.1 3.6.2 3.7.0 3.8.0 3.9.0 4.0.0 4.1.0 4.1.1 4.10.0 4.10.1 4.11.0 4.12.0 4.13.0 4.13.1 4.13.2 4.14.0 4.14.1 4.14.2 4.14.3 4.14.4 4.14.5 4.14.6 4.2.0 4.2.1 4.3.0 4.3.1 4.3.2 4.4.0 4.5.0 4.6.1 4.7.0 4.7.1 4.8.0 4.8.1 4.9.0 trunk 1.9.0 2.0.0 2.0.1 2.0.2 2.0.3 2.0.4 2.0.5 2.0.6 2.0.7 2.1.0 2.1.1 2.1.2 2.1.3 2.1.4 2.1.5 2.1.6 2.1.7 2.1.8 2.10.0 2.10.1 2.10.2 2.10.3 2.10.4 2.11.0 2.11.1 2.11.2 2.11.3 2.12.0 2.12.1 2.12.2 2.12.3 2.13.0 2.13.1 2.13.2 2.13.3 2.13.4 2.14.0 2.15.0 2.16.0 2.16.1 2.17.0 2.17.1 2.17.3 2.18.0 2.18.1 2.19.1 2.19.2 2.19.3 2.19.4 2.19.5 2.19.6 2.19.7 2.19.8 2.2.0 2.2.1 2.2.2 2.2.3 2.2.4 2.2.5 2.2.6 2.20.0 2.20.1 2.20.2 2.21.0 2.21.1 2.21.2 2.21.3 2.21.4 2.22.0 2.22.1 2.22.2 2.22.3 2.23.0 2.23.1 2.23.2 2.24.0 2.24.1 2.24.2 2.25.0 2.25.1 2.25.2 2.25.3 2.26.0 2.27.0 2.27.1 2.27.2 2.27.3 2.28.0 2.29.0 2.29.1 2.29.2
give / vendor / tecnickcom / tcpdf / tools / tcpdf_addfont.php
give / vendor / tecnickcom / tcpdf / tools Last commit date
.htaccess 5 years ago convert_fonts_examples.txt 5 years ago tcpdf_addfont.php 5 years ago
tcpdf_addfont.php
270 lines
1 #!/usr/bin/env php
2 <?php
3 //============================================================+
4 // File name : tcpdf_addfont.php
5 // Version : 1.0.002
6 // Begin : 2013-05-13
7 // Last Update : 2013-08-05
8 // Authors : Nicola Asuni - Tecnick.com LTD - www.tecnick.com - info@tecnick.com
9 // Remi Collet
10 // License : GNU-LGPL v3 (http://www.gnu.org/copyleft/lesser.html)
11 // -------------------------------------------------------------------
12 // Copyright (C) 2011-2013 Nicola Asuni - Tecnick.com LTD
13 //
14 // This file is part of TCPDF software library.
15 //
16 // TCPDF is free software: you can redistribute it and/or modify it
17 // under the terms of the GNU Lesser General Public License as
18 // published by the Free Software Foundation, either version 3 of the
19 // License, or (at your option) any later version.
20 //
21 // TCPDF is distributed in the hope that it will be useful, but
22 // WITHOUT ANY WARRANTY; without even the implied warranty of
23 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
24 // See the GNU Lesser General Public License for more details.
25 //
26 // You should have received a copy of the License
27 // along with TCPDF. If not, see
28 // <http://www.tecnick.com/pagefiles/tcpdf/LICENSE.TXT>.
29 //
30 // See LICENSE.TXT file for more information.
31 // -------------------------------------------------------------------
32 //
33 // Description : This is a command line script to generate TCPDF fonts.
34 //
35 //============================================================+
36
37 /**
38 * @file
39 * This is a command line script to generate TCPDF fonts.<br>
40 * @package com.tecnick.tcpdf
41 * @version 1.0.000
42 */
43
44 if (php_sapi_name() != 'cli') {
45 echo 'You need to run this command from console.';
46 exit(1);
47 }
48
49 $tcpdf_include_dirs = array(realpath(dirname(__FILE__).'/../tcpdf.php'), '/usr/share/php/tcpdf/tcpdf.php', '/usr/share/tcpdf/tcpdf.php', '/usr/share/php-tcpdf/tcpdf.php', '/var/www/tcpdf/tcpdf.php', '/var/www/html/tcpdf/tcpdf.php', '/usr/local/apache2/htdocs/tcpdf/tcpdf.php');
50 foreach ($tcpdf_include_dirs as $tcpdf_include_path) {
51 if (@file_exists($tcpdf_include_path)) {
52 require_once($tcpdf_include_path);
53 break;
54 }
55 }
56
57 /**
58 * Display help guide for this command.
59 */
60 function showHelp() {
61 $help = <<<EOD
62 tcpdf_addfont - command line tool to convert fonts for the TCPDF library.
63
64 Usage: tcpdf_addfont.php [ options ] -i fontfile[,fontfile]...
65
66 Options:
67
68 -t
69 --type Font type. Leave empty for autodetect mode.
70 Valid values are:
71 TrueTypeUnicode
72 TrueType
73 Type1
74 CID0JP = CID-0 Japanese
75 CID0KR = CID-0 Korean
76 CID0CS = CID-0 Chinese Simplified
77 CID0CT = CID-0 Chinese Traditional
78
79 -e
80 --enc Name of the encoding table to use. Leave empty for
81 default mode. Omit this parameter for TrueType Unicode
82 and symbolic fonts like Symbol or ZapfDingBats.
83
84 -f
85 --flags Unsigned 32-bit integer containing flags specifying
86 various characteristics of the font (PDF32000:2008 -
87 9.8.2 Font Descriptor Flags): +1 for fixed font; +4 for
88 symbol or +32 for non-symbol; +64 for italic. Fixed and
89 Italic mode are generally autodetected so you have to
90 set it to 32 = non-symbolic font (default) or 4 =
91 symbolic font.
92
93 -o
94 --outpath Output path for generated font files (must be writeable
95 by the web server). Leave empty for default font folder.
96
97 -p
98 --platid Platform ID for CMAP table to extract (when building a
99 Unicode font for Windows this value should be 3, for
100 Macintosh should be 1).
101
102 -n
103 --encid Encoding ID for CMAP table to extract (when building a
104 Unicode font for Windows this value should be 1, for
105 Macintosh should be 0). When Platform ID is 3, legal
106 values for Encoding ID are: 0=Symbol, 1=Unicode,
107 2=ShiftJIS, 3=PRC, 4=Big5, 5=Wansung, 6=Johab,
108 7=Reserved, 8=Reserved, 9=Reserved, 10=UCS-4.
109
110 -b
111 --addcbbox Includes the character bounding box information on the
112 php font file.
113
114 -l
115 --link Link to system font instead of copying the font data #
116 (not transportable) - Note: do not work with Type1 fonts.
117
118 -i
119 --fonts Comma-separated list of input font files.
120
121 -h
122 --help Display this help and exit.
123 EOD;
124 echo $help."\n\n";
125 exit(0);
126 }
127
128 // remove the name of the executing script
129 array_shift($argv);
130
131 // no options chosen
132 if (!is_array($argv)) {
133 showHelp();
134 }
135
136 // initialize the array of options
137 $options = array('type'=>'', 'enc'=>'', 'flags'=>32, 'outpath'=>K_PATH_FONTS, 'platid'=>3, 'encid'=>1, 'addcbbox'=>false, 'link'=>false);
138
139 // short input options
140 $sopt = '';
141 $sopt .= 't:';
142 $sopt .= 'e:';
143 $sopt .= 'f:';
144 $sopt .= 'o:';
145 $sopt .= 'p:';
146 $sopt .= 'n:';
147 $sopt .= 'b';
148 $sopt .= 'l';
149 $sopt .= 'i:';
150 $sopt .= 'h';
151
152 // long input options
153 $lopt = array();
154 $lopt[] = 'type:';
155 $lopt[] = 'enc:';
156 $lopt[] = 'flags:';
157 $lopt[] = 'outpath:';
158 $lopt[] = 'platid:';
159 $lopt[] = 'encid:';
160 $lopt[] = 'addcbbox';
161 $lopt[] = 'link';
162 $lopt[] = 'fonts:';
163 $lopt[] = 'help';
164
165 // parse input options
166 $inopt = getopt($sopt, $lopt);
167
168 // import options (with some sanitization)
169 foreach ($inopt as $opt => $val) {
170 switch ($opt) {
171 case 't':
172 case 'type': {
173 if (in_array($val, array('TrueTypeUnicode', 'TrueType', 'Type1', 'CID0JP', 'CID0KR', 'CID0CS', 'CID0CT'))) {
174 $options['type'] = $val;
175 }
176 break;
177 }
178 case 'e':
179 case 'enc': {
180 $options['enc'] = $val;
181 break;
182 }
183 case 'f':
184 case 'flags': {
185 $options['flags'] = intval($val);
186 break;
187 }
188 case 'o':
189 case 'outpath': {
190 $options['outpath'] = realpath($val);
191 if (substr($options['outpath'], -1) != '/') {
192 $options['outpath'] .= '/';
193 }
194 break;
195 }
196 case 'p':
197 case 'platid': {
198 $options['platid'] = min(max(1, intval($val)), 3);
199 break;
200 }
201 case 'n':
202 case 'encid': {
203 $options['encid'] = min(max(0, intval($val)), 10);
204 break;
205 }
206 case 'b':
207 case 'addcbbox': {
208 $options['addcbbox'] = true;
209 break;
210 }
211 case 'l':
212 case 'link': {
213 $options['link'] = true;
214 break;
215 }
216 case 'i':
217 case 'fonts': {
218 $options['fonts'] = explode(',', $val);
219 break;
220 }
221 case 'h':
222 case 'help':
223 default: {
224 showHelp();
225 break;
226 }
227 } // end of switch
228 } // end of while loop
229
230 if (empty($options['fonts'])) {
231 echo "ERROR: missing input fonts (try --help for usage)\n\n";
232 exit(2);
233 }
234
235 // check the output path
236 if (!is_dir($options['outpath']) OR !is_writable($options['outpath'])) {
237 echo "ERROR: Can't write to ".$options['outpath']."\n\n";
238 exit(3);
239 }
240
241 echo "\n>>> Converting fonts for TCPDF:\n";
242
243 echo '*** Output dir set to '.$options['outpath']."\n";
244
245 // check if there are conversion errors
246 $errors = false;
247
248 foreach ($options['fonts'] as $font) {
249 $fontfile = realpath($font);
250 $fontname = TCPDF_FONTS::addTTFfont($fontfile, $options['type'], $options['enc'], $options['flags'], $options['outpath'], $options['platid'], $options['encid'], $options['addcbbox'], $options['link']);
251 if ($fontname === false) {
252 $errors = true;
253 echo "--- ERROR: can't add ".$font."\n";
254 } else {
255 echo "+++ OK : ".$fontfile.' added as '.$fontname."\n";
256 }
257 }
258
259 if ($errors) {
260 echo "--- Process completed with ERRORS!\n\n";
261 exit(4);
262 }
263
264 echo ">>> Process successfully completed!\n\n";
265 exit(0);
266
267 //============================================================+
268 // END OF FILE
269 //============================================================+
270