32
1
mirror of https://github.com/vdm-io/tcpdf.git synced 2024-11-26 06:17:33 +00:00

6.0.068 (2014-04-22)

- Some Datamatrix barcode bugs were fixed.
This commit is contained in:
nicolaasuni 2014-04-22 21:50:00 +01:00
parent f545d6dce7
commit c36a5bc4fb
6 changed files with 46 additions and 25 deletions

View File

@ -1,3 +1,6 @@
6.0.068 (2014-04-22)
- Some Datamatrix barcode bugs were fixed.
6.0.067 (2014-04-21) 6.0.067 (2014-04-21)
- startLayer() method signature was changed to include a new "lock" parameter. - startLayer() method signature was changed to include a new "lock" parameter.

View File

@ -8,8 +8,8 @@ http://sourceforge.net/donate/index.php?group_id=128076
------------------------------------------------------------ ------------------------------------------------------------
Name: TCPDF Name: TCPDF
Version: 6.0.067 Version: 6.0.063
Release date: 2014-04-21 Release date: 2014-04-22
Author: Nicola Asuni Author: Nicola Asuni
Copyright (c) 2002-2014: Copyright (c) 2002-2014:

View File

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

View File

@ -1,13 +1,13 @@
<?php <?php
//============================================================+ //============================================================+
// File name : datamatrix.php // File name : datamatrix.php
// Version : 1.0.004 // Version : 1.0.005
// Begin : 2010-06-07 // Begin : 2010-06-07
// Last Update : 2013-12-12 // Last Update : 2014-04-22
// Author : Nicola Asuni - Tecnick.com LTD - www.tecnick.com - info@tecnick.com // Author : Nicola Asuni - Tecnick.com LTD - www.tecnick.com - info@tecnick.com
// License : GNU-LGPL v3 (http://www.gnu.org/copyleft/lesser.html) // License : GNU-LGPL v3 (http://www.gnu.org/copyleft/lesser.html)
// ------------------------------------------------------------------- // -------------------------------------------------------------------
// Copyright (C) 2010-2012 Nicola Asuni - Tecnick.com LTD // Copyright (C) 2010-2014 Nicola Asuni - Tecnick.com LTD
// //
// This file is part of TCPDF software library. // This file is part of TCPDF software library.
// //
@ -40,7 +40,7 @@
* *
* @package com.tecnick.tcpdf * @package com.tecnick.tcpdf
* @author Nicola Asuni * @author Nicola Asuni
* @version 1.0.004 * @version 1.0.005
*/ */
// custom definitions // custom definitions
@ -256,6 +256,7 @@ class Datamatrix {
return false; return false;
} elseif ($params[11] > $nd) { } elseif ($params[11] > $nd) {
// add padding // add padding
if ((($params[11] - $nd) > 1) AND ($cw[($nd - 1)] != 254)) {
if ($this->last_enc == ENC_EDF) { if ($this->last_enc == ENC_EDF) {
// switch to ASCII encoding // switch to ASCII encoding
$cw[] = 124; $cw[] = 124;
@ -265,6 +266,7 @@ class Datamatrix {
$cw[] = 254; $cw[] = 254;
++$nd; ++$nd;
} }
}
if ($params[11] > $nd) { if ($params[11] > $nd) {
// add first pad // add first pad
$cw[] = 129; $cw[] = 129;
@ -652,6 +654,9 @@ class Datamatrix {
switch ($mode) { switch ($mode) {
case ENC_ASCII: { // ASCII character 0 to 127 case ENC_ASCII: { // ASCII character 0 to 127
$cw = 254; $cw = 254;
if ($this->last_enc == ENC_EDF) {
$cw = 124;
}
break; break;
} }
case ENC_C40: { // Upper-case alphanumeric case ENC_C40: { // Upper-case alphanumeric
@ -707,6 +712,8 @@ class Datamatrix {
$cw_num = 0; // number of data codewords $cw_num = 0; // number of data codewords
$data_lenght = strlen($data); // number of chars $data_lenght = strlen($data); // number of chars
while ($pos < $data_lenght) { while ($pos < $data_lenght) {
// set last used encoding
$this->last_enc = $enc;
switch ($enc) { switch ($enc) {
case ENC_ASCII: { // STEP B. While in ASCII encodation case ENC_ASCII: { // STEP B. While in ASCII encodation
if (($data_lenght > 1) AND ($pos < ($data_lenght - 1)) AND ($this->isCharMode(ord($data[$pos]), ENC_ASCII_NUM) AND $this->isCharMode(ord($data[$pos + 1]), ENC_ASCII_NUM))) { if (($data_lenght > 1) AND ($pos < ($data_lenght - 1)) AND ($this->isCharMode(ord($data[$pos]), ENC_ASCII_NUM) AND $this->isCharMode(ord($data[$pos + 1]), ENC_ASCII_NUM))) {
@ -799,7 +806,13 @@ class Datamatrix {
// 1. If the C40 encoding is at the point of starting a new double symbol character and if the look-ahead test (starting at step J) indicates another mode, switch to that mode. // 1. If the C40 encoding is at the point of starting a new double symbol character and if the look-ahead test (starting at step J) indicates another mode, switch to that mode.
$newenc = $this->lookAheadTest($data, $pos, $enc); $newenc = $this->lookAheadTest($data, $pos, $enc);
if ($newenc != $enc) { if ($newenc != $enc) {
// switch to new encoding
$enc = $newenc; $enc = $newenc;
if ($enc != ENC_ASCII) {
// set unlatch character
$cw[] = $this->getSwitchEncodingCodeword(ENC_ASCII);
++$cw_num;
}
$cw[] = $this->getSwitchEncodingCodeword($enc); $cw[] = $this->getSwitchEncodingCodeword($enc);
++$cw_num; ++$cw_num;
$pos -= $p; $pos -= $p;
@ -811,20 +824,22 @@ class Datamatrix {
// process last data (if any) // process last data (if any)
if ($p > 0) { if ($p > 0) {
// get remaining number of data symbols // get remaining number of data symbols
$cwr = ($this->getMaxDataCodewords($cw_num + 2) - $cw_num); $cwr = ($this->getMaxDataCodewords($cw_num) - $cw_num);
if (($cwr == 1) AND ($p == 1)) { if (($cwr == 1) AND ($p == 1)) {
// d. If one symbol character remains and one C40 value (data character) remains to be encoded // d. If one symbol character remains and one C40 value (data character) remains to be encoded
$c1 = array_shift($temp_cw); $c1 = array_shift($temp_cw);
--$p; --$p;
$cw[] = ($c1 + 1); $cw[] = ($chr + 1);
++$cw_num; ++$cw_num;
$pos = $epos;
} elseif (($cwr == 2) AND ($p == 1)) { } elseif (($cwr == 2) AND ($p == 1)) {
// c. If two symbol characters remain and only one C40 value (data character) remains to be encoded // c. If two symbol characters remain and only one C40 value (data character) remains to be encoded
$c1 = array_shift($temp_cw); $c1 = array_shift($temp_cw);
--$p; --$p;
$cw[] = 254; $cw[] = 254;
$cw[] = ($c1 + 1); $cw[] = ($chr + 1);
$cw_num += 2; $cw_num += 2;
$pos = $epos;
} elseif (($cwr == 2) AND ($p == 2)) { } elseif (($cwr == 2) AND ($p == 2)) {
// b. If two symbol characters remain and two C40 values remain to be encoded // b. If two symbol characters remain and two C40 values remain to be encoded
$c1 = array_shift($temp_cw); $c1 = array_shift($temp_cw);
@ -834,12 +849,14 @@ class Datamatrix {
$cw[] = ($tmp >> 8); $cw[] = ($tmp >> 8);
$cw[] = ($tmp % 256); $cw[] = ($tmp % 256);
$cw_num += 2; $cw_num += 2;
$pos = $epos;
} else { } else {
// switch to ASCII encoding // switch to ASCII encoding
if ($enc != ENC_ASCII) { if ($enc != ENC_ASCII) {
$enc = ENC_ASCII; $enc = ENC_ASCII;
$cw[] = $this->getSwitchEncodingCodeword($enc); $cw[] = $this->getSwitchEncodingCodeword($enc);
++$cw_num; ++$cw_num;
$pos = ($epos - $p);
} }
} }
} }
@ -862,6 +879,8 @@ class Datamatrix {
if (($field_lenght == 4) OR ($epos == $data_lenght) OR !$this->isCharMode($chr, ENC_EDF)) { if (($field_lenght == 4) OR ($epos == $data_lenght) OR !$this->isCharMode($chr, ENC_EDF)) {
if (($epos == $data_lenght) AND ($field_lenght < 3)) { if (($epos == $data_lenght) AND ($field_lenght < 3)) {
$enc = ENC_ASCII; $enc = ENC_ASCII;
$cw[] = $this->getSwitchEncodingCodeword($enc);
++$cw_num;
break; break;
} }
if ($field_lenght < 4) { if ($field_lenght < 4) {
@ -873,6 +892,7 @@ class Datamatrix {
$temp_cw[] = 0; $temp_cw[] = 0;
} }
$enc = ENC_ASCII; $enc = ENC_ASCII;
$this->last_enc = $enc;
} }
// encodes four data characters in three codewords // encodes four data characters in three codewords
$tcw = (($temp_cw[0] & 0x3F) << 2) + (($temp_cw[1] & 0x30) >> 4); $tcw = (($temp_cw[0] & 0x3F) << 2) + (($temp_cw[1] & 0x30) >> 4);
@ -939,8 +959,6 @@ class Datamatrix {
} }
} // end of switch enc } // end of switch enc
} // end of while } // end of while
// set last used encoding
$this->last_enc = $enc;
return $cw; return $cw;
} }

View File

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

View File

@ -1,9 +1,9 @@
<?php <?php
//============================================================+ //============================================================+
// File name : tcpdf.php // File name : tcpdf.php
// Version : 6.0.067 // Version : 6.0.068
// Begin : 2002-08-03 // Begin : 2002-08-03
// Last Update : 2014-04-21 // Last Update : 2014-04-22
// Author : Nicola Asuni - Tecnick.com LTD - www.tecnick.com - info@tecnick.com // Author : Nicola Asuni - Tecnick.com LTD - www.tecnick.com - info@tecnick.com
// License : GNU-LGPL v3 (http://www.gnu.org/copyleft/lesser.html) // 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> * Tools to encode your unicode fonts are on fonts/utils directory.</p>
* @package com.tecnick.tcpdf * @package com.tecnick.tcpdf
* @author Nicola Asuni * @author Nicola Asuni
* @version 6.0.067 * @version 6.0.068
*/ */
// TCPDF configuration // 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> * 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 * @package com.tecnick.tcpdf
* @brief PHP class for generating PDF documents without requiring external extensions. * @brief PHP class for generating PDF documents without requiring external extensions.
* @version 6.0.067 * @version 6.0.068
* @author Nicola Asuni - info@tecnick.com * @author Nicola Asuni - info@tecnick.com
*/ */
class TCPDF { class TCPDF {