From 824f8c45edb20e27221e92805b0090f1768a2756 Mon Sep 17 00:00:00 2001 From: tcit Date: Sat, 27 Sep 2014 19:34:17 +0200 Subject: changed mpdf with tcpdf --- inc/3rdparty/libraries/tcpdf/tools/.htaccess | 1 + .../tcpdf/tools/convert_fonts_examples.txt | 28 +++ .../libraries/tcpdf/tools/tcpdf_addfont.php | 269 +++++++++++++++++++++ 3 files changed, 298 insertions(+) create mode 100644 inc/3rdparty/libraries/tcpdf/tools/.htaccess create mode 100644 inc/3rdparty/libraries/tcpdf/tools/convert_fonts_examples.txt create mode 100755 inc/3rdparty/libraries/tcpdf/tools/tcpdf_addfont.php (limited to 'inc/3rdparty/libraries/tcpdf/tools') diff --git a/inc/3rdparty/libraries/tcpdf/tools/.htaccess b/inc/3rdparty/libraries/tcpdf/tools/.htaccess new file mode 100644 index 00000000..8d2f2563 --- /dev/null +++ b/inc/3rdparty/libraries/tcpdf/tools/.htaccess @@ -0,0 +1 @@ +deny from all diff --git a/inc/3rdparty/libraries/tcpdf/tools/convert_fonts_examples.txt b/inc/3rdparty/libraries/tcpdf/tools/convert_fonts_examples.txt new file mode 100644 index 00000000..d5f8a4ea --- /dev/null +++ b/inc/3rdparty/libraries/tcpdf/tools/convert_fonts_examples.txt @@ -0,0 +1,28 @@ +./tcpdf_addfont.php -b -t Type1 -f 4 -e symbol -i pdfasymbol.pfb +./tcpdf_addfont.php -b -t Type1 -f 4 -i pdfazapfdingbats.pfb +./tcpdf_addfont.php -b -t Type1 -f 32 -e cp1252 -i pdfatimes.pfb,pdfatimesb.pfb,pdfahelvetica.pfb,pdfahelveticab.pfb +./tcpdf_addfont.php -b -t Type1 -f 33 -e cp1252 -i pdfacourier.pfb,pdfacourierb.pfb +./tcpdf_addfont.php -b -t Type1 -f 96 -e cp1252 -i pdfahelveticabi.pfb,pdfahelveticai.pfb,pdfatimesi.pfb,pdfatimesbi.pfb +./tcpdf_addfont.php -b -t Type1 -f 97 -e cp1252 -i pdfacourieri.pfb,pdfacourierbi.pfb + + +./tcpdf_addfont.php -b -t TrueTypeUnicode -f 32 -i DejaVuSans.ttf,DejaVuSans-Bold.ttf,DejaVuSansCondensed.ttf,DejaVuSansCondensed-Bold.ttf,DejaVuSans-ExtraLight.ttf,DejaVuSerif.ttf,DejaVuSerif-Bold.ttf,DejaVuSerifCondensed.ttf,DejaVuSerifCondensed-Bold.ttf +./tcpdf_addfont.php -b -t TrueTypeUnicode -f 33 -i DejaVuSansMono.ttf,DejaVuSansMono-Bold.ttf +./tcpdf_addfont.php -b -t TrueTypeUnicode -f 96 -i DejaVuSans-BoldOblique.ttf,DejaVuSansCondensed-BoldOblique.ttf,DejaVuSansCondensed-Oblique.ttf,DejaVuSerifCondensed-BoldItalic.ttf,DejaVuSerifCondensed-Italic.ttf,DejaVuSerif-Italic.ttf,DejaVuSerif-BoldItalic.ttf,DejaVuSans-Oblique.ttf +./tcpdf_addfont.php -b -t TrueTypeUnicode -f 97 -i DejaVuSansMono-BoldOblique.ttf,DejaVuSansMono-Oblique.ttf + + + +./tcpdf_addfont.php -b -t TrueTypeUnicode -f 32 -i FreeSans.ttf,FreeSansBold.ttf,FreeSerif.ttf,FreeSerifBold.ttf +./tcpdf_addfont.php -b -t TrueTypeUnicode -f 33 -i FreeMono.ttf,FreeMonoBold.ttf +./tcpdf_addfont.php -b -t TrueTypeUnicode -f 96 -i FreeSansBoldOblique.ttf,FreeSansOblique.ttf,FreeSerifBoldItalic.ttf,FreeSerifItalic.ttf +./tcpdf_addfont.php -b -t TrueTypeUnicode -f 97 -i FreeMonoBoldOblique.ttf,FreeMonoOblique.ttf + + +./tcpdf_addfont.php -b -t TrueTypeUnicode -i aeAlArabiya.ttf,aeFurat.ttf + + +./tcpdf_addfont.php -b -t CID0JP -f 32 -i cid0jp.ttf +./tcpdf_addfont.php -b -t CID0KR -f 32 -i cid0kr.ttf +./tcpdf_addfont.php -b -t CID0CS -f 32 -i cid0cs.ttf +./tcpdf_addfont.php -b -t CID0CT -f 32 -i cid0ct.ttf diff --git a/inc/3rdparty/libraries/tcpdf/tools/tcpdf_addfont.php b/inc/3rdparty/libraries/tcpdf/tools/tcpdf_addfont.php new file mode 100755 index 00000000..c0b258ec --- /dev/null +++ b/inc/3rdparty/libraries/tcpdf/tools/tcpdf_addfont.php @@ -0,0 +1,269 @@ +#!/usr/bin/php -q +. +// +// See LICENSE.TXT file for more information. +// ------------------------------------------------------------------- +// +// Description : This is a command line script to generate TCPDF fonts. +// +//============================================================+ + +/** + * @file + * This is a command line script to generate TCPDF fonts.
+ * @package com.tecnick.tcpdf + * @version 1.0.000 + */ + +if (php_sapi_name() != 'cli') { + echo 'You need to run this command from console.'; + exit(1); +} + +$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'); +foreach ($tcpdf_include_dirs as $tcpdf_include_path) { + if (@file_exists($tcpdf_include_path)) { + require_once($tcpdf_include_path); + break; + } +} + +/** + * Display help guide for this command. + */ +function showHelp() { + $help = <<'', 'enc'=>'', 'flags'=>32, 'outpath'=>K_PATH_FONTS, 'platid'=>3, 'encid'=>1, 'addcbbox'=>false, 'link'=>false); + +// short input options +$sopt = ''; +$sopt .= 't:'; +$sopt .= 'e:'; +$sopt .= 'f:'; +$sopt .= 'o:'; +$sopt .= 'p:'; +$sopt .= 'n:'; +$sopt .= 'b'; +$sopt .= 'l'; +$sopt .= 'i:'; +$sopt .= 'h'; + +// long input options +$lopt = array(); +$lopt[] = 'type:'; +$lopt[] = 'enc:'; +$lopt[] = 'flags:'; +$lopt[] = 'outpath:'; +$lopt[] = 'platid:'; +$lopt[] = 'encid:'; +$lopt[] = 'addcbbox'; +$lopt[] = 'link'; +$lopt[] = 'fonts:'; +$lopt[] = 'help'; + +// parse input options +$inopt = getopt($sopt, $lopt); + +// import options (with some sanitization) +foreach ($inopt as $opt => $val) { + switch ($opt) { + case 't': + case 'type': { + if (in_array($val, array('TrueTypeUnicode', 'TrueType', 'Type1', 'CID0JP', 'CID0KR', 'CID0CS', 'CID0CT'))) { + $options['type'] = $val; + } + break; + } + case 'e': + case 'enc': { + $options['enc'] = $val; + break; + } + case 'f': + case 'flags': { + $options['flags'] = intval($val); + break; + } + case 'o': + case 'outpath': { + $options['outpath'] = realpath($val); + if (substr($options['outpath'], -1) != '/') { + $options['outpath'] .= '/'; + } + break; + } + case 'p': + case 'platid': { + $options['platid'] = min(max(1, intval($val)), 3); + break; + } + case 'n': + case 'encid': { + $options['encid'] = min(max(0, intval($val)), 10); + break; + } + case 'b': + case 'addcbbox': { + $options['addcbbox'] = true; + break; + } + case 'l': + case 'link': { + $options['link'] = true; + break; + } + case 'i': + case 'fonts': { + $options['fonts'] = explode(',', $val); + break; + } + case 'h': + case 'help': + default: { + showHelp(); + break; + } + } // end of switch +} // end of while loop + +if (empty($options['fonts'])) { + echo "ERROR: missing input fonts (try --help for usage)\n\n"; + exit(2); +} + +// check the output path +if (!is_dir($options['outpath']) OR !is_writable($options['outpath'])) { + echo "ERROR: Can't write to ".$options['outpath']."\n\n"; + exit(3); +} + +echo "\n>>> Converting fonts for TCPDF:\n"; + +echo '*** Output dir set to '.$options['outpath']."\n"; + +// check if there are conversion errors +$errors = false; + +foreach ($options['fonts'] as $font) { + $fontfile = realpath($font); + $fontname = TCPDF_FONTS::addTTFfont($fontfile, $options['type'], $options['enc'], $options['flags'], $options['outpath'], $options['platid'], $options['encid'], $options['addcbbox'], $options['link']); + if ($fontname === false) { + $errors = true; + echo "--- ERROR: can't add ".$font."\n"; + } else { + echo "+++ OK : ".$fontfile.' added as '.$fontname."\n"; + } +} + +if ($errors) { + echo "--- Process completed with ERRORS!\n\n"; + exit(4); +} + +echo ">>> Process successfully completed!\n\n"; +exit(0); + +//============================================================+ +// END OF FILE +//============================================================+ -- cgit v1.2.3