From 9c04ada91fc000905cb4476224e1b2343e7576fe Mon Sep 17 00:00:00 2001 From: nicolaasuni Date: Mon, 13 Jan 2014 18:14:28 +0000 Subject: [PATCH] 6.0.054 (2014-01-13) - Bug #877 "Parenteses causing corrupt text" was fixed. --- CHANGELOG.TXT | 3 +++ README.TXT | 4 ++-- composer.json | 2 +- examples/example_039.php | 4 ++-- tcpdf.php | 24 +++++++++++++++--------- 5 files changed, 23 insertions(+), 14 deletions(-) diff --git a/CHANGELOG.TXT b/CHANGELOG.TXT index 8d7b789..0ab197f 100644 --- a/CHANGELOG.TXT +++ b/CHANGELOG.TXT @@ -1,3 +1,6 @@ +6.0.054 (2014-01-13) + - Bug #877 "Parenteses causing corrupt text" was fixed. + 6.0.053 (2014-01-03) - Bug #876 "Cell padding should not be multiplied with number of lines in getStringHeight" was fixed. - Patch #68 "Empty img src attribute leads to access of uninitialized string offset" was applied. diff --git a/README.TXT b/README.TXT index 315380e..985d294 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.053 -Release date: 2014-01-03 +Version: 6.0.054 +Release date: 2014-01-13 Author: Nicola Asuni Copyright (c) 2002-2014: diff --git a/composer.json b/composer.json index 0cc9809..d993856 100644 --- a/composer.json +++ b/composer.json @@ -1,6 +1,6 @@ { "name": "tecnick.com/tcpdf", - "version": "6.0.053", + "version": "6.0.054", "homepage": "http://www.tcpdf.org/", "type": "library", "description": "TCPDF is a PHP class for generating PDF documents.", diff --git a/examples/example_039.php b/examples/example_039.php index 5d5ad3b..1784381 100644 --- a/examples/example_039.php +++ b/examples/example_039.php @@ -2,7 +2,7 @@ //============================================================+ // File name : example_039.php // Begin : 2008-10-16 -// Last Update : 2013-05-14 +// Last Update : 2014-01-13 // // Description : Example 039 for TCPDF class // HTML justification @@ -75,7 +75,7 @@ $pdf->SetFont('helvetica', 'B', 20); $pdf->Write(0, 'Example of HTML Justification', '', 0, 'L', true, 0, false, false, 0); // create some HTML content -$html = 'a abc abcdefghijkl abcdef abcdefg abcdefghi a abc abcd test alt attribute abcdef abcdefg abcdefghi a abc abcd abcdef abcdefg abcdefghi a abc abcd abcdef abcdefg abcdefghi a abc abcd abcdef abcdefg abcdefghi a abc abcd abcdef abcdefg abcdefghi a abc abcd abcdef abcdefg abcdefghi a abc abcd abcdef abcdefg abcdefghi a abc abcd abcdef abcdefg abcdefghi a abc abcd abcdef abcdefg abcdefghi a abc abcd abcdef abcdefg start a abc before yellow color after a abc abcd abcdef abcdefg abcdefghi a abc abcd end abcdefg abcdefghi a abc abcd abcdef abcdefg abcdefghi a abc abcd abcdef abcdefg abcdefghi a abc abcd abcdef abcdefg abcdefghi a abc abcd abcdef abcdefg abcdefghi a abc abcd abcdef abcdefg abcdefghi a abc abcd abcdef abcdefg abcdefghi a abc abcd abcdef abcdefg abcdefghi
abcd abcdef abcdefg abcdefghi
abcd abcde abcdef
'; +$html = 'a abc abcdefghijkl (abcdef) abcdefg abcdefghi a ((abc)) abcd test alt attribute abcdef abcdefg abcdefghi a abc abcd abcdef abcdefg abcdefghi a abc abcd abcdef abcdefg abcdefghi a abc abcd abcdef abcdefg abcdefghi a abc \(abcd\) abcdef abcdefg abcdefghi a abc \\\(abcd\\\) abcdef abcdefg abcdefghi a abc abcd abcdef abcdefg abcdefghi a abc abcd abcdef abcdefg abcdefghi a abc abcd abcdef abcdefg abcdefghi a abc abcd abcdef abcdefg start a abc before yellow color after a abc abcd abcdef abcdefg abcdefghi a abc abcd end abcdefg abcdefghi a abc abcd abcdef abcdefg abcdefghi a abc abcd abcdef abcdefg abcdefghi a abc abcd abcdef abcdefg abcdefghi a abc abcd abcdef abcdefg abcdefghi a abc abcd abcdef abcdefg abcdefghi a abc abcd abcdef abcdefg abcdefghi a abc abcd abcdef abcdefg abcdefghi
abcd abcdef abcdefg abcdefghi
abcd abcde abcdef
'; // set core font $pdf->SetFont('helvetica', '', 10); diff --git a/tcpdf.php b/tcpdf.php index 6005329..531a210 100644 --- a/tcpdf.php +++ b/tcpdf.php @@ -1,9 +1,9 @@ * @package com.tecnick.tcpdf * @author Nicola Asuni - * @version 6.0.053 + * @version 6.0.054 */ // 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.
* @package com.tecnick.tcpdf * @brief PHP class for generating PDF documents without requiring external extensions. - * @version 6.0.053 + * @version 6.0.054 * @author Nicola Asuni - info@tecnick.com */ class TCPDF { @@ -6226,7 +6226,7 @@ class TCPDF { } $this->adjustCellPadding($border); $lines = $this->getNumLines($txt, $w, $reseth, $autopadding, $cellpadding, $border); - $height = $this->getCellHeight(($lines * $this->FontSize), $autopadding); + $height = $lines * $this->getCellHeight($this->FontSize, $autopadding); $this->cell_padding = $prev_cell_padding; $this->lasth = $prev_lasth; return $height; @@ -17768,14 +17768,20 @@ Putting 1 is equivalent to putting 0 and calling Ln() just after. Default value: $spacew /= ($this->font_stretching / 100); } // escape special characters + $pos = 0; $pmid = preg_replace('/[\\\][\(]/x', '\\#!#OP#!#', $pmid); $pmid = preg_replace('/[\\\][\)]/x', '\\#!#CP#!#', $pmid); if (preg_match_all('/\[\(([^\)]*)\)\]/x', $pmid, $pamatch) > 0) { foreach($pamatch[0] as $pk => $pmatch) { - $pmatch = str_replace('#!#OP#!#', '(', $pmatch); - $pmatch = str_replace('#!#CP#!#', ')', $pmatch); - $newpmid = '[('.str_replace(chr(0).chr(32), ') '.sprintf('%F', $spacew).' (', $pamatch[1][$pk]).')]'; - $pmid = str_replace($pmatch, $newpmid, $pmid); + $replace = $pamatch[1][$pk]; + $replace = str_replace('#!#OP#!#', '(', $replace); + $replace = str_replace('#!#CP#!#', ')', $replace); + $newpmid = '[('.str_replace(chr(0).chr(32), ') '.sprintf('%F', $spacew).' (', $replace).')]'; + $pos = strpos($pmid, $pmatch, $pos); + if ($pos !== FALSE) { + $pmid = substr_replace($pmid, $newpmid, $pos, strlen($pmatch)); + } + ++$pos; } unset($pamatch); }