From 7424ac0d45f0c3780300bf19ae4ec4154bb57980 Mon Sep 17 00:00:00 2001 From: nicolaasuni Date: Wed, 15 May 2013 16:30:05 +0100 Subject: [PATCH] 6.0.016 (2013-05-15) - The tcpdf_addfont.php tool was improved (thanks to Remi Collet). --- CHANGELOG.TXT | 5 ++++- README.TXT | 4 ++-- composer.json | 2 +- include/tcpdf_fonts.php | 2 +- include/tcpdf_static.php | 2 +- tcpdf.php | 8 ++++---- tools/tcpdf_addfont.php | 43 ++++++++++++++++++++++++++++++---------- 7 files changed, 45 insertions(+), 21 deletions(-) diff --git a/CHANGELOG.TXT b/CHANGELOG.TXT index 13cd404..44bd601 100644 --- a/CHANGELOG.TXT +++ b/CHANGELOG.TXT @@ -1,4 +1,7 @@ -6.0.015 (2013-04-14) +6.0.016 (2013-05-15) + - The tcpdf_addfont.php tool was improved (thanks to Remi Collet). + +6.0.015 (2013-05-14) - Some unused vars were removed from AddFont() method. - Some directories were moved inside the examples directory. - All examples were updated to reflect the new default structure. diff --git a/README.TXT b/README.TXT index 5dea457..9c2c19d 100644 --- a/README.TXT +++ b/README.TXT @@ -8,8 +8,8 @@ http://sourceforge.net/donate/index.php?group_id=128076 ------------------------------------------------------------ Name: TCPDF -Version: 6.0.015 -Release date: 2013-05-14 +Version: 6.0.016 +Release date: 2013-05-15 Author: Nicola Asuni Copyright (c) 2002-2013: diff --git a/composer.json b/composer.json index a3a122f..d2ffdea 100644 --- a/composer.json +++ b/composer.json @@ -1,6 +1,6 @@ { "name": "tecnick.com/tcpdf", - "version": "6.0.015", + "version": "6.0.016", "homepage": "http://www.tcpdf.org/", "type": "library", "description": "TCPDF is a PHP class for generating PDF documents.", diff --git a/include/tcpdf_fonts.php b/include/tcpdf_fonts.php index 3147f8d..48be5f8 100644 --- a/include/tcpdf_fonts.php +++ b/include/tcpdf_fonts.php @@ -58,7 +58,7 @@ class TCPDF_FONTS { * @param $encid (int) Encoding ID for CMAP table to extract (when building a Unicode font for Windows this value should be 1, for Macintosh should be 0). When Platform ID is 3, legal values for Encoding ID are: 0=Symbol, 1=Unicode, 2=ShiftJIS, 3=PRC, 4=Big5, 5=Wansung, 6=Johab, 7=Reserved, 8=Reserved, 9=Reserved, 10=UCS-4. * @param $addcbbox (boolean) If true includes the character bounding box information on the php font file. * @param $link (boolean) If true link to system font instead of copying the font data (not transportable) - Note: do not work with Type1 fonts. - * @return (string) TCPDF font name. + * @return (string) TCPDF font name or boolean false in case of error. * @author Nicola Asuni * @since 5.9.123 (2010-09-30) * @public static diff --git a/include/tcpdf_static.php b/include/tcpdf_static.php index 6fa7c74..c1bad9e 100644 --- a/include/tcpdf_static.php +++ b/include/tcpdf_static.php @@ -55,7 +55,7 @@ class TCPDF_STATIC { * Current TCPDF version. * @private static */ - private static $tcpdf_version = '6.0.015'; + private static $tcpdf_version = '6.0.016'; /** * String alias for total number of pages. diff --git a/tcpdf.php b/tcpdf.php index e0da273..dd0cedd 100644 --- a/tcpdf.php +++ b/tcpdf.php @@ -1,9 +1,9 @@ * @package com.tecnick.tcpdf * @author Nicola Asuni - * @version 6.0.015 + * @version 6.0.016 */ // Load main configuration file only if the K_TCPDF_EXTERNAL_CONFIG constant is set to false. @@ -178,7 +178,7 @@ require_once(dirname(__FILE__).'/include/tcpdf_static.php'); * TCPDF project (http://www.tcpdf.org) has been originally derived in 2002 from the Public Domain FPDF class by Olivier Plathey (http://www.fpdf.org), but now is almost entirely rewritten.
* @package com.tecnick.tcpdf * @brief PHP class for generating PDF documents without requiring external extensions. - * @version 6.0.015 + * @version 6.0.016 * @author Nicola Asuni - info@tecnick.com */ class TCPDF { diff --git a/tools/tcpdf_addfont.php b/tools/tcpdf_addfont.php index 6ade4ef..cfe4943 100755 --- a/tools/tcpdf_addfont.php +++ b/tools/tcpdf_addfont.php @@ -2,10 +2,11 @@ $val) { } case 'o': case 'outpath': { - $options['outpath'] = $val; + $options['outpath'] = realpath($val); + if (substr($options['outpath'], -1) != '/') { + $options['outpath'] .= '/'; + } break; } case 'p': @@ -225,24 +229,41 @@ foreach ($inopt as $opt => $val) { } // end of while loop if (empty($options['fonts'])) { - die("ERROR: missing input fonts (try --help for usage)\n"); + 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'])) { - die("ERROR: Can't write to ".$options['outpath']."\n"); + echo "ERROR: Can't write to ".$options['outpath']."\n\n"; + exit(3); } -echo "*** Converting fonts for TCPDF ***\n\n"; +echo "\n>>> Converting fonts for TCPDF:\n"; -echo '--- Output dir set to '.$options['outpath']."\n\n"; +echo '*** Output dir set to '.$options['outpath']."\n"; -foreach ($options['fonts'] as $fontfile) { +// 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']); - echo ">>> ".$fontfile.' added as '.$fontname."\n"; + if ($fontname === false) { + $errors = true; + echo "--- ERROR: can't add ".$font."\n"; + } else { + echo "+++ OK : ".$fontfile.' added as '.$fontname."\n"; + } } -echo "\n"; +if ($errors) { + echo "--- Process completed with ERRORS!\n\n"; + exit(4); +} + +echo ">>> Process successfully completed!\n\n"; +exit(0); //============================================================+ // END OF FILE