diff --git a/CHANGELOG.TXT b/CHANGELOG.TXT index 8f05074..b44794a 100644 --- a/CHANGELOG.TXT +++ b/CHANGELOG.TXT @@ -1,3 +1,6 @@ +6.0.087 (2014-06-25) + - A bug affecting fitcell option in Multicell was fixed. + 6.0.086 (2014-06-20) - Bug item #938 "Hyphenation-dash extends outside of cell" was fixed (collateral effect). diff --git a/README.TXT b/README.TXT index 8c80c14..a039957 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.086 -Release date: 2014-06-20 +Version: 6.0.087 +Release date: 2014-06-25 Author: Nicola Asuni Copyright (c) 2002-2014: diff --git a/composer.json b/composer.json index 2c70404..cef2fc5 100644 --- a/composer.json +++ b/composer.json @@ -1,6 +1,6 @@ { "name": "tecnick.com/tcpdf", - "version": "6.0.086", + "version": "6.0.087", "homepage": "http://www.tcpdf.org/", "type": "library", "description": "TCPDF is a PHP class for generating PDF documents.", diff --git a/tcpdf.php b/tcpdf.php index 17c5422..fc05a7e 100644 --- a/tcpdf.php +++ b/tcpdf.php @@ -1,7 +1,7 @@ * @package com.tecnick.tcpdf * @author Nicola Asuni - * @version 6.0.085 + * @version 6.0.087 */ // 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.085 + * @version 6.0.087 * @author Nicola Asuni - info@tecnick.com */ class TCPDF { @@ -1291,14 +1291,14 @@ class TCPDF { /** * Boolean flag to enable document timestamping with TSA. * @protected - * @since 6.0.085 (2014-06-19) + * @since 6.0.087 (2014-06-19) */ protected $tsa_timestamp = false; /** * Timestamping data. * @protected - * @since 6.0.085 (2014-06-19) + * @since 6.0.087 (2014-06-19) */ protected $tsa_data = array(); @@ -5870,20 +5870,20 @@ class TCPDF { if ($maxh > 0) { // get text height $text_height = $this->getStringHeight($w, $txt, $reseth, $autopadding, $mc_padding, $border); - if ($fitcell) { + if ($fitcell AND ($text_height > $maxh) AND ($this->FontSizePt > 1)) { // try to reduce font size to fit text on cell (use a quick search algorithm) $fmin = 1; $fmax = $this->FontSizePt; $diff_epsilon = (1 / $this->k); // one point (min resolution) - $maxit = (2 * intval($fmax)); // max number of iterations - while ($maxit > 0) { + $maxit = (2 * min(100, max(10, intval($fmax)))); // max number of iterations + while ($maxit >= 0) { $fmid = (($fmax + $fmin) / 2); $this->SetFontSize($fmid, false); $this->resetLastH(); $text_height = $this->getStringHeight($w, $txt, $reseth, $autopadding, $mc_padding, $border); $diff = ($maxh - $text_height); if ($diff >= 0) { - if ($diff < $diff_epsilon) { + if ($diff <= $diff_epsilon) { break; } $fmin = $fmid; @@ -5892,10 +5892,15 @@ class TCPDF { } --$maxit; } - if ($maxit <= 0) { - $fmid = $fmin; + if ($maxit < 0) { + // premature exit, we get the minimum font value to fit the cell + $this->SetFontSize($fmin); + $this->resetLastH(); + $text_height = $this->getStringHeight($w, $txt, $reseth, $autopadding, $mc_padding, $border); + } else { + $this->SetFontSize($fmid); + $this->resetLastH(); } - $this->SetFontSize($fmid); } if ($text_height < $maxh) { if ($valign == 'M') { @@ -13621,7 +13626,7 @@ class TCPDF { * @param $tsa_cert (string) Specifies the location of TSA certificate for authorization (optional for cURL) * @public * @author Richard Stockinger - * @since 6.0.085 (2014-06-16) + * @since 6.0.087 (2014-06-16) */ public function setTimeStamp($tsa_host='', $tsa_username='', $tsa_password='', $tsa_cert='') { $this->tsa_data = array(); @@ -13649,7 +13654,7 @@ class TCPDF { * @return (string) Timestamped digital signature * @protected * @author Richard Stockinger - * @since 6.0.085 (2014-06-16) + * @since 6.0.087 (2014-06-16) */ protected function applyTSA($signature) { if (!$this->tsa_timestamp) {