6.0.080 (2014-05-20)

- Bug item #921 "Fatal error in hyphenateText() function" was fixed.
- Bug item #923 "Automatic Hyphenation error" was fixed.
- Patch #70 "Augument TCPDFBarcode classes with ability to return raw png image data" was applied.
This commit is contained in:
nicolaasuni 2014-05-20 20:50:29 +01:00
parent 78b7610910
commit fcd0098a2a
7 changed files with 89 additions and 40 deletions

View File

@ -1,3 +1,8 @@
6.0.080 (2014-05-20)
- Bug item #921 "Fatal error in hyphenateText() function" was fixed.
- Bug item #923 "Automatic Hyphenation error" was fixed.
- Patch #70 "Augument TCPDFBarcode classes with ability to return raw png image data" was applied.
6.0.079 (2014-05-19)
- Patch item #69 "Named destinations, HTML internal and external links" was merged.
- Bug item #920 "hyphenateText() should not hyphenate the content of style-tags in HTML mode" was fixed.

View File

@ -8,8 +8,8 @@ http://sourceforge.net/donate/index.php?group_id=128076
------------------------------------------------------------
Name: TCPDF
Version: 6.0.079
Release date: 2014-05-19
Version: 6.0.080
Release date: 2014-05-20
Author: Nicola Asuni
Copyright (c) 2002-2014:

View File

@ -1,6 +1,6 @@
{
"name": "tecnick.com/tcpdf",
"version": "6.0.079",
"version": "6.0.080",
"homepage": "http://www.tcpdf.org/",
"type": "library",
"description": "TCPDF is a PHP class for generating PDF documents.",

View File

@ -55,7 +55,7 @@ class TCPDF_STATIC {
* Current TCPDF version.
* @private static
*/
private static $tcpdf_version = '6.0.079';
private static $tcpdf_version = '6.0.080';
/**
* String alias for total number of pages.

View File

@ -1,9 +1,9 @@
<?php
//============================================================+
// File name : tcpdf.php
// Version : 6.0.079
// Version : 6.0.080
// Begin : 2002-08-03
// Last Update : 2014-05-19
// Last Update : 2014-05-20
// Author : Nicola Asuni - Tecnick.com LTD - www.tecnick.com - info@tecnick.com
// License : GNU-LGPL v3 (http://www.gnu.org/copyleft/lesser.html)
// -------------------------------------------------------------------
@ -104,7 +104,7 @@
* Tools to encode your unicode fonts are on fonts/utils directory.</p>
* @package com.tecnick.tcpdf
* @author Nicola Asuni
* @version 6.0.079
* @version 6.0.080
*/
// TCPDF configuration
@ -128,7 +128,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.<br>
* @package com.tecnick.tcpdf
* @brief PHP class for generating PDF documents without requiring external extensions.
* @version 6.0.079
* @version 6.0.080
* @author Nicola Asuni - info@tecnick.com
*/
class TCPDF {
@ -21994,7 +21994,7 @@ Putting 1 is equivalent to putting 0 and calling Ln() just after. Default value:
return TCPDF_FONTS::UTF8StringToArray($dictionary[$word_string], $this->isunicode, $this->CurrentFont);
}
// surround word with '_' characters
$tmpword = array_merge(array(95), $word, array(95));
$tmpword = array_merge(array(46), $word, array(46));
$tmpnumchars = $numchars + 2;
$maxpos = $tmpnumchars - $charmin;
for ($pos = 0; $pos < $maxpos; ++$pos) {
@ -22006,15 +22006,18 @@ Putting 1 is equivalent to putting 0 and calling Ln() just after. Default value:
$pattern_length = count($pattern);
$digits = 1;
for ($j = 0; $j < $pattern_length; ++$j) {
// check if $pattern[$j] is a number
// check if $pattern[$j] is a number = hyphenation level (only numbers from 1 to 5 are valid)
if (($pattern[$j] >= 48) AND ($pattern[$j] <= 57)) {
if ($j == 0) {
$zero = $pos - 1;
} else {
$zero = $pos + $j - $digits;
}
if (!isset($hyphenword[$zero]) OR ($hyphenword[$zero] != $pattern[$j])) {
$hyphenword[$zero] = TCPDF_FONTS::unichr($pattern[$j], $this->isunicode);
// get hyphenation level
$level = ($pattern[$j] - 48);
// if two levels from two different patterns match at the same point, the higher one is selected.
if (!isset($hyphenword[$zero]) OR ($hyphenword[$zero] < $level)) {
$hyphenword[$zero] = $level;
}
++$digits;
}
@ -22025,6 +22028,7 @@ Putting 1 is equivalent to putting 0 and calling Ln() just after. Default value:
$inserted = 0;
$maxpos = $numchars - $rightmin;
for ($i = $leftmin; $i <= $maxpos; ++$i) {
// only odd levels indicate allowed hyphenation points
if (isset($hyphenword[$i]) AND (($hyphenword[$i] % 2) != 0)) {
// 173 = soft hyphen character
array_splice($word, $i + $inserted, 0, 173);
@ -22079,8 +22083,15 @@ Putting 1 is equivalent to putting 0 and calling Ln() just after. Default value:
// end of HTML tag
$intag = false;
// check for style tag
if (empty(array_diff(array_slice($txtarr, -6, 5), array(115, 116, 121, 108, 101)))) { // = 'style'
if (empty(array_diff(array_slice($txtarr, -7, 1), array(47)))) { // '/' = 47
$expected = array(115, 116, 121, 108, 101); // = 'style'
$current = array_slice($txtarr, -6, 5); // last 5 chars
$compare = array_diff($expected, $current);
if (empty($compare)) {
// check if it is a closing tag
$expected = array(47); // = '/'
$current = array_slice($txtarr, -7, 1);
$compare = array_diff($expected, $current);
if (empty($compare)) {
// closing style tag
$skip = false;
} else {

View File

@ -1,13 +1,13 @@
<?php
//============================================================+
// File name : tcpdf_barcodes_1d.php
// Version : 1.0.025
// Version : 1.0.026
// Begin : 2008-06-09
// Last Update : 2014-04-25
// Last Update : 2014-05-20
// Author : Nicola Asuni - Tecnick.com LTD - www.tecnick.com - info@tecnick.com
// License : GNU-LGPL v3 (http://www.gnu.org/copyleft/lesser.html)
// -------------------------------------------------------------------
// Copyright (C) 2008-2013 Nicola Asuni - Tecnick.com LTD
// Copyright (C) 2008-2014 Nicola Asuni - Tecnick.com LTD
//
// This file is part of TCPDF software library.
//
@ -37,14 +37,14 @@
* PHP class to creates array representations for common 1D barcodes to be used with TCPDF.
* @package com.tecnick.tcpdf
* @author Nicola Asuni
* @version 1.0.025
* @version 1.0.026
*/
/**
* @class TCPDFBarcode
* PHP class to creates array representations for common 1D barcodes to be used with TCPDF (http://www.tcpdf.org).<br>
* @package com.tecnick.tcpdf
* @version 1.0.025
* @version 1.0.026
* @author Nicola Asuni
*/
class TCPDFBarcode {
@ -162,6 +162,25 @@ class TCPDFBarcode {
return $html;
}
/**
* Send a PNG image representation of barcode (requires GD or Imagick library).
* @param $w (int) Width of a single bar element in pixels.
* @param $h (int) Height of a single bar element in pixels.
* @param $color (array) RGB (0-255) foreground color for bar elements (background is transparent).
* @public
*/
public function getBarcodePNG($w=2, $h=30, $color=array(0,0,0)) {
$data = $this->getBarcodePngData($w, $h, $color);
// send headers
header('Content-Type: image/png');
header('Cache-Control: public, must-revalidate, max-age=0'); // HTTP/1.1
header('Pragma: public');
header('Expires: Sat, 26 Jul 1997 05:00:00 GMT'); // Date in the past
header('Last-Modified: '.gmdate('D, d M Y H:i:s').' GMT');
//header('Content-Length: '.strlen($data));
echo $data;
}
/**
* Return a PNG image representation of barcode (requires GD or Imagick library).
* @param $w (int) Width of a single bar element in pixels.
@ -170,7 +189,7 @@ class TCPDFBarcode {
* @return image or false in case of error.
* @public
*/
public function getBarcodePNG($w=2, $h=30, $color=array(0,0,0)) {
public function getBarcodePngData($w=2, $h=30, $color=array(0,0,0)) {
// calculate image size
$width = ($this->barcode_array['maxw'] * $w);
$height = $h;
@ -208,18 +227,15 @@ class TCPDFBarcode {
}
$x += $bw;
}
// send headers
header('Content-Type: image/png');
header('Cache-Control: public, must-revalidate, max-age=0'); // HTTP/1.1
header('Pragma: public');
header('Expires: Sat, 26 Jul 1997 05:00:00 GMT'); // Date in the past
header('Last-Modified: '.gmdate('D, d M Y H:i:s').' GMT');
if ($imagick) {
$png->drawimage($bar);
echo $png;
return $png;
} else {
ob_start();
imagepng($png);
$imagedata = ob_get_clean();
imagedestroy($png);
return $imagedata;
}
}

View File

@ -1,13 +1,13 @@
<?php
//============================================================+
// File name : tcpdf_barcodes_2d.php
// Version : 1.0.014
// Version : 1.0.015
// Begin : 2009-04-07
// Last Update : 2013-03-17
// Last Update : 2014-05-20
// Author : Nicola Asuni - Tecnick.com LTD - www.tecnick.com - info@tecnick.com
// License : GNU-LGPL v3 (http://www.gnu.org/copyleft/lesser.html)
// -------------------------------------------------------------------
// Copyright (C) 2009-2013 Nicola Asuni - Tecnick.com LTD
// Copyright (C) 2009-2014 Nicola Asuni - Tecnick.com LTD
//
// This file is part of TCPDF software library.
//
@ -37,14 +37,14 @@
* PHP class to creates array representations for 2D barcodes to be used with TCPDF.
* @package com.tecnick.tcpdf
* @author Nicola Asuni
* @version 1.0.014
* @version 1.0.015
*/
/**
* @class TCPDF2DBarcode
* PHP class to creates array representations for 2D barcodes to be used with TCPDF (http://www.tcpdf.org).
* @package com.tecnick.tcpdf
* @version 1.0.014
* @version 1.0.015
* @author Nicola Asuni
*/
class TCPDF2DBarcode {
@ -162,6 +162,26 @@ class TCPDF2DBarcode {
return $html;
}
/**
* Send a PNG image representation of barcode (requires GD or Imagick library).
* @param $w (int) Width of a single rectangle element in pixels.
* @param $h (int) Height of a single rectangle element in pixels.
* @param $color (array) RGB (0-255) foreground color for bar elements (background is transparent).
* @public
*/
public function getBarcodePNG($w=3, $h=3, $color=array(0,0,0)) {
$data = $this->getBarcodePngData($w, $h, $color);
// send headers
header('Content-Type: image/png');
header('Cache-Control: public, must-revalidate, max-age=0'); // HTTP/1.1
header('Pragma: public');
header('Expires: Sat, 26 Jul 1997 05:00:00 GMT'); // Date in the past
header('Last-Modified: '.gmdate('D, d M Y H:i:s').' GMT');
//header('Content-Length: '.strlen($data));
echo $data;
}
/**
* Return a PNG image representation of barcode (requires GD or Imagick library).
* @param $w (int) Width of a single rectangle element in pixels.
@ -170,7 +190,7 @@ class TCPDF2DBarcode {
* @return image or false in case of error.
* @public
*/
public function getBarcodePNG($w=3, $h=3, $color=array(0,0,0)) {
public function getBarcodePngData($w=3, $h=3, $color=array(0,0,0)) {
// calculate image size
$width = ($this->barcode_array['num_cols'] * $w);
$height = ($this->barcode_array['num_rows'] * $h);
@ -211,18 +231,15 @@ class TCPDF2DBarcode {
}
$y += $h;
}
// send headers
header('Content-Type: image/png');
header('Cache-Control: public, must-revalidate, max-age=0'); // HTTP/1.1
header('Pragma: public');
header('Expires: Sat, 26 Jul 1997 05:00:00 GMT'); // Date in the past
header('Last-Modified: '.gmdate('D, d M Y H:i:s').' GMT');
if ($imagick) {
$png->drawimage($bar);
echo $png;
return $png;
} else {
ob_start();
imagepng($png);
$imagedata = ob_get_clean();
imagedestroy($png);
return $imagedata;
}
}