6.0.044 (2013-11-10)

- Bug #857 "Undefined offset error" was fixed.
- The uniord method now uses a static cache to improve performances (thanks to Mathieu Masseboeuf for the sugegstion).
- Two bugs in the TCPDF_FONTS class were fixed.
This commit is contained in:
nicolaasuni 2013-11-10 13:01:43 +00:00
parent 7745dbfdf1
commit 2a323b71aa
6 changed files with 50 additions and 16 deletions

View File

@ -1,3 +1,8 @@
6.0.044 (2013-11-10)
- Bug #857 "Undefined offset error" was fixed.
- The uniord method now uses a static cache to improve performances (thanks to Mathieu Masseboeuf for the sugegstion).
- Two bugs in the TCPDF_FONTS class were fixed.
6.0.043 (2013-10-29)
- Bug #854 "CSS instruction display" was fixed.

View File

@ -8,8 +8,8 @@ http://sourceforge.net/donate/index.php?group_id=128076
------------------------------------------------------------
Name: TCPDF
Version: 6.0.043
Release date: 2013-10-29
Version: 6.0.044
Release date: 2013-11-10
Author: Nicola Asuni
Copyright (c) 2002-2013:

View File

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

View File

@ -1,9 +1,9 @@
<?php
//============================================================+
// File name : tcpdf_fonts.php
// Version : 1.0.009
// Version : 1.0.010
// Begin : 2008-01-01
// Last Update : 2013-09-04
// Last Update : 2013-11-10
// Author : Nicola Asuni - Tecnick.com LTD - www.tecnick.com - info@tecnick.com
// License : GNU-LGPL v3 (http://www.gnu.org/copyleft/lesser.html)
// -------------------------------------------------------------------
@ -42,11 +42,17 @@
* @class TCPDF_FONTS
* Font methods for TCPDF library.
* @package com.tecnick.tcpdf
* @version 1.0.009
* @version 1.0.010
* @author Nicola Asuni - info@tecnick.com
*/
class TCPDF_FONTS {
/**
* Static cache used for speed up uniord performances
* @protected
*/
protected static $cache_uniord = array();
/**
* Convert and add the selected TrueType or Type1 font to the fonts folder (that must be writeable).
* @param $fontfile (string) Font file (full path).
@ -607,7 +613,7 @@ class TCPDF_FONTS {
// combine high and low bytes
$c = (($i << 8) + $j);
$idRangeOffset = ($subHeaders[$k]['idRangeOffset'] + $j - $subHeaders[$k]['firstCode']);
$g = ($glyphIndexArray[$idRangeOffset] + $idDelta[$k]) % 65536;
$g = ($glyphIndexArray[$idRangeOffset] + $subHeaders[$k]['idDelta']) % 65536;
if ($g < 0) {
$g = 0;
}
@ -1074,7 +1080,7 @@ class TCPDF_FONTS {
$c = (($i << 8) + $j);
if (isset($subsetchars[$c])) {
$idRangeOffset = ($subHeaders[$k]['idRangeOffset'] + $j - $subHeaders[$k]['firstCode']);
$g = ($glyphIndexArray[$idRangeOffset] + $idDelta[$k]) % 65536;
$g = ($glyphIndexArray[$idRangeOffset] + $subHeaders[$k]['idDelta']) % 65536;
if ($g < 0) {
$g = 0;
}
@ -1756,6 +1762,20 @@ class TCPDF_FONTS {
return $outstr;
}
/**
* Converts UTF-8 character to integer value.<br>
* Uses the getUniord() method if the value is not cached.
* @param $uch (string) character string to process.
* @return integer Unicode value
* @public static
*/
public static function uniord($uch) {
if (!isset(self::$cache_uniord[$uch])) {
self::$cache_uniord[$uch] = self::getUniord($uch);
}
return self::$cache_uniord[$uch];
}
/**
* Converts UTF-8 character to integer value.<br>
* Invalid byte sequences will be replaced with 0xFFFD (replacement character)<br>
@ -1789,7 +1809,7 @@ class TCPDF_FONTS {
* @author Nicola Asuni
* @public static
*/
public static function uniord($uch) {
public static function getUniord($uch) {
if (function_exists('mb_convert_encoding')) {
list(, $char) = @unpack('N', mb_convert_encoding($uch, 'UCS-4BE', 'UTF-8'));
if ($char >= 0) {

View File

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

View File

@ -1,7 +1,7 @@
<?php
//============================================================+
// File name : tcpdf.php
// Version : 6.0.043
// Version : 6.0.044
// Begin : 2002-08-03
// Last Update : 2013-10-29
// Author : Nicola Asuni - Tecnick.com LTD - www.tecnick.com - info@tecnick.com
@ -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.043
* @version 6.0.044
*/
// 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.043
* @version 6.0.044
* @author Nicola Asuni - info@tecnick.com
*/
class TCPDF {
@ -9404,7 +9404,7 @@ class TCPDF {
}
if (!TCPDF_STATIC::empty_string($this->keywords)) {
// Keywords associated with the document.
$out .= ' /Keywords '.$this->_textstring($this->keywords.' TCPDF', $oid);
$out .= ' /Keywords '.$this->_textstring($this->keywords, $oid);
}
if (!TCPDF_STATIC::empty_string($this->creator)) {
// If the document was converted to PDF from another format, the name of the conforming product that created the original document from which it was converted.
@ -9473,7 +9473,7 @@ class TCPDF {
$xmp .= "\t\t\t".'</dc:description>'."\n";
$xmp .= "\t\t\t".'<dc:subject>'."\n";
$xmp .= "\t\t\t\t".'<rdf:Bag>'."\n";
$xmp .= "\t\t\t\t\t".'<rdf:li>'.TCPDF_STATIC::_escapeXML($this->keywords).' TCPDF</rdf:li>'."\n";
$xmp .= "\t\t\t\t\t".'<rdf:li>'.TCPDF_STATIC::_escapeXML($this->keywords).'</rdf:li>'."\n";
$xmp .= "\t\t\t\t".'</rdf:Bag>'."\n";
$xmp .= "\t\t\t".'</dc:subject>'."\n";
$xmp .= "\t\t".'</rdf:Description>'."\n";
@ -9496,7 +9496,7 @@ class TCPDF {
$xmp .= "\t\t\t".'<xmp:MetadataDate>'.$doccreationdate.'</xmp:MetadataDate>'."\n";
$xmp .= "\t\t".'</rdf:Description>'."\n";
$xmp .= "\t\t".'<rdf:Description rdf:about="" xmlns:pdf="http://ns.adobe.com/pdf/1.3/">'."\n";
$xmp .= "\t\t\t".'<pdf:Keywords>'.TCPDF_STATIC::_escapeXML($this->keywords).' TCPDF</pdf:Keywords>'."\n";
$xmp .= "\t\t\t".'<pdf:Keywords>'.TCPDF_STATIC::_escapeXML($this->keywords).'</pdf:Keywords>'."\n";
$xmp .= "\t\t\t".'<pdf:Producer>'.TCPDF_STATIC::_escapeXML(TCPDF_STATIC::getTCPDFProducer()).'</pdf:Producer>'."\n";
$xmp .= "\t\t".'</rdf:Description>'."\n";
$xmp .= "\t\t".'<rdf:Description rdf:about="" xmlns:xmpMM="http://ns.adobe.com/xap/1.0/mm/">'."\n";
@ -17613,6 +17613,9 @@ Putting 1 is equivalent to putting 0 and calling Ln() just after. Default value:
case 'l': {
// get current X position
preg_match('/([0-9\.\+\-]*)[\s]('.$strpiece[1][0].')[\s]('.$strpiece[2][0].')([\s]*)/x', $pmid, $xmatches);
if (!isset($xmatches[1])) {
break;
}
$currentxpos = $xmatches[1];
$textpos = $currentxpos;
if (($strcount <= $maxkk) AND ($strpiece[2][0] == 'Td')) {
@ -17636,6 +17639,9 @@ Putting 1 is equivalent to putting 0 and calling Ln() just after. Default value:
continue;
}
preg_match('/([0-9\.\+\-]*)[\s]([0-9\.\+\-]*)[\s]([0-9\.\+\-]*)[\s]('.$strpiece[1][0].')[\s](re)([\s]*)/x', $pmid, $xmatches);
if (!isset($xmatches[1])) {
break;
}
$currentxpos = $xmatches[1];
global $x_diff, $w_diff;
$x_diff = 0;
@ -17675,6 +17681,9 @@ Putting 1 is equivalent to putting 0 and calling Ln() just after. Default value:
case 'c': {
// get current X position
preg_match('/([0-9\.\+\-]*)[\s]([0-9\.\+\-]*)[\s]([0-9\.\+\-]*)[\s]([0-9\.\+\-]*)[\s]([0-9\.\+\-]*)[\s]('.$strpiece[1][0].')[\s](c)([\s]*)/x', $pmid, $xmatches);
if (!isset($xmatches[1])) {
break;
}
$currentxpos = $xmatches[1];
// justify block
$pmid = preg_replace_callback('/('.$xmatches[1].')[\s]('.$xmatches[2].')[\s]('.$xmatches[3].')[\s]('.$xmatches[4].')[\s]('.$xmatches[5].')[\s]('.$strpiece[1][0].')[\s](c)([\s]*)/x',