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)
- 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
Version: 6.0.067
Release date: 2014-04-21
Version: 6.0.063
Release date: 2014-04-22
Author: Nicola Asuni
Copyright (c) 2002-2014:

View File

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

View File

@ -1,13 +1,13 @@
<?php
//============================================================+
// File name : datamatrix.php
// Version : 1.0.004
// Version : 1.0.005
// 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
// 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.
//
@ -40,7 +40,7 @@
*
* @package com.tecnick.tcpdf
* @author Nicola Asuni
* @version 1.0.004
* @version 1.0.005
*/
// custom definitions
@ -256,14 +256,16 @@ class Datamatrix {
return false;
} elseif ($params[11] > $nd) {
// add padding
if ($this->last_enc == ENC_EDF) {
// switch to ASCII encoding
$cw[] = 124;
++$nd;
} elseif (($this->last_enc != ENC_ASCII) AND ($this->last_enc != ENC_BASE256)) {
// switch to ASCII encoding
$cw[] = 254;
++$nd;
if ((($params[11] - $nd) > 1) AND ($cw[($nd - 1)] != 254)) {
if ($this->last_enc == ENC_EDF) {
// switch to ASCII encoding
$cw[] = 124;
++$nd;
} elseif (($this->last_enc != ENC_ASCII) AND ($this->last_enc != ENC_BASE256)) {
// switch to ASCII encoding
$cw[] = 254;
++$nd;
}
}
if ($params[11] > $nd) {
// add first pad
@ -652,6 +654,9 @@ class Datamatrix {
switch ($mode) {
case ENC_ASCII: { // ASCII character 0 to 127
$cw = 254;
if ($this->last_enc == ENC_EDF) {
$cw = 124;
}
break;
}
case ENC_C40: { // Upper-case alphanumeric
@ -707,6 +712,8 @@ class Datamatrix {
$cw_num = 0; // number of data codewords
$data_lenght = strlen($data); // number of chars
while ($pos < $data_lenght) {
// set last used encoding
$this->last_enc = $enc;
switch ($enc) {
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))) {
@ -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.
$newenc = $this->lookAheadTest($data, $pos, $enc);
if ($newenc != $enc) {
// switch to new encoding
$enc = $newenc;
if ($enc != ENC_ASCII) {
// set unlatch character
$cw[] = $this->getSwitchEncodingCodeword(ENC_ASCII);
++$cw_num;
}
$cw[] = $this->getSwitchEncodingCodeword($enc);
++$cw_num;
$pos -= $p;
@ -811,20 +824,22 @@ class Datamatrix {
// process last data (if any)
if ($p > 0) {
// 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)) {
// d. If one symbol character remains and one C40 value (data character) remains to be encoded
$c1 = array_shift($temp_cw);
--$p;
$cw[] = ($c1 + 1);
$cw[] = ($chr + 1);
++$cw_num;
$pos = $epos;
} elseif (($cwr == 2) AND ($p == 1)) {
// c. If two symbol characters remain and only one C40 value (data character) remains to be encoded
$c1 = array_shift($temp_cw);
--$p;
$cw[] = 254;
$cw[] = ($c1 + 1);
$cw[] = ($chr + 1);
$cw_num += 2;
$pos = $epos;
} elseif (($cwr == 2) AND ($p == 2)) {
// b. If two symbol characters remain and two C40 values remain to be encoded
$c1 = array_shift($temp_cw);
@ -834,12 +849,14 @@ class Datamatrix {
$cw[] = ($tmp >> 8);
$cw[] = ($tmp % 256);
$cw_num += 2;
$pos = $epos;
} else {
// switch to ASCII encoding
if ($enc != ENC_ASCII) {
$enc = ENC_ASCII;
$cw[] = $this->getSwitchEncodingCodeword($enc);
++$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 (($epos == $data_lenght) AND ($field_lenght < 3)) {
$enc = ENC_ASCII;
$cw[] = $this->getSwitchEncodingCodeword($enc);
++$cw_num;
break;
}
if ($field_lenght < 4) {
@ -873,6 +892,7 @@ class Datamatrix {
$temp_cw[] = 0;
}
$enc = ENC_ASCII;
$this->last_enc = $enc;
}
// encodes four data characters in three codewords
$tcw = (($temp_cw[0] & 0x3F) << 2) + (($temp_cw[1] & 0x30) >> 4);
@ -939,8 +959,6 @@ class Datamatrix {
}
} // end of switch enc
} // end of while
// set last used encoding
$this->last_enc = $enc;
return $cw;
}

View File

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

View File

@ -1,9 +1,9 @@
<?php
//============================================================+
// File name : tcpdf.php
// Version : 6.0.067
// Version : 6.0.068
// 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
// 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.067
* @version 6.0.068
*/
// 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.067
* @version 6.0.068
* @author Nicola Asuni - info@tecnick.com
*/
class TCPDF {