diff --git a/CHANGELOG.TXT b/CHANGELOG.TXT index 378920c..7446cdc 100644 --- a/CHANGELOG.TXT +++ b/CHANGELOG.TXT @@ -1,3 +1,8 @@ +6.0.073 (2014-04-29) + - Bug #913 "Possible bug with line-height" was fixed. + - Bug #914 "MultiCell and FitCell" was fixed. + - Bug #915 "Problem with SVG Image using Radial Gradients" was fixed. + 6.0.072 (2014-04-27) - Deprecated curly braces substring syntax was replaced with square braces. diff --git a/README.TXT b/README.TXT index 5b39d1d..9c39745 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.072 -Release date: 2014-04-27 +Version: 6.0.073 +Release date: 2014-04-29 Author: Nicola Asuni Copyright (c) 2002-2014: diff --git a/composer.json b/composer.json index 246d00b..a846d6c 100644 --- a/composer.json +++ b/composer.json @@ -1,6 +1,6 @@ { "name": "tecnick.com/tcpdf", - "version": "6.0.072", + "version": "6.0.073", "homepage": "http://www.tcpdf.org/", "type": "library", "description": "TCPDF is a PHP class for generating PDF documents.", diff --git a/include/tcpdf_static.php b/include/tcpdf_static.php index bf84b94..5b283a6 100644 --- a/include/tcpdf_static.php +++ b/include/tcpdf_static.php @@ -7,7 +7,7 @@ // 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) 2002-2013 Nicola Asuni - Tecnick.com LTD +// Copyright (C) 2002-2014 Nicola Asuni - Tecnick.com LTD // // This file is part of TCPDF software library. // @@ -55,7 +55,7 @@ class TCPDF_STATIC { * Current TCPDF version. * @private static */ - private static $tcpdf_version = '6.0.072'; + private static $tcpdf_version = '6.0.073'; /** * String alias for total number of pages. diff --git a/tcpdf.php b/tcpdf.php index 3c29ea1..f48b7e3 100644 --- a/tcpdf.php +++ b/tcpdf.php @@ -1,9 +1,9 @@ * @package com.tecnick.tcpdf * @author Nicola Asuni - * @version 6.0.072 + * @version 6.0.073 */ // 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.072 + * @version 6.0.073 * @author Nicola Asuni - info@tecnick.com */ class TCPDF { @@ -5757,7 +5757,7 @@ class TCPDF { * @param $autopadding (boolean) if true, uses internal padding and automatically adjust it to account for line width. * @param $maxh (float) maximum height. It should be >= $h and less then remaining space to the bottom of the page, or 0 for disable this feature. This feature works only when $ishtml=false. * @param $valign (string) Vertical alignment of text (requires $maxh = $h > 0). Possible values are:. This feature works only when $ishtml=false and the cell must fit in a single page. - * @param $fitcell (boolean) if true attempt to fit all the text within the cell by reducing the font size (do not work in HTML mode). + * @param $fitcell (boolean) if true attempt to fit all the text within the cell by reducing the font size (do not work in HTML mode). $maxh must be greater than 0 and wqual to $h. * @return int Return the number of cells or 1 for html mode. * @public * @since 1.3 @@ -5838,6 +5838,11 @@ class TCPDF { $nl = 1; } else { // ******* Write simple text $prev_FontSizePt = $this->FontSizePt; + if ($fitcell) { + // ajust height values + $tobottom = ($this->h - $this->y - $this->bMargin - $this->cell_padding['T'] - $this->cell_padding['B']); + $h = $maxh = max(min($h, $tobottom), min($maxh, $tobottom)); + } // vertical alignment if ($maxh > 0) { // get text height @@ -5846,17 +5851,20 @@ class TCPDF { // try to reduce font size to fit text on cell (use a quick search algorithm) $fmin = 1; $fmax = $this->FontSizePt; - $prev_text_height = $text_height; - $maxit = 100; // max number of iterations + $diff_epsilon = (1 / $this->k); // one point (min resolution) + $maxit = ($fmax - $fmin); // 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); - if (($text_height == $maxh) OR (($text_height < $maxh) AND ($fmin >= ($fmax - 0.01)))) { - break; - } elseif ($text_height < $maxh) { - $fmin = $fmid; + $diff = ($maxh - $text_height); + if ($diff >= 0) { + if ($diff < $diff_epsilon) { + break; + } else { + $fmin = $fmid; + } } else { $fmax = $fmid; } @@ -18639,7 +18647,7 @@ Putting 1 is equivalent to putting 0 and calling Ln() just after. Default value: } if (($this->htmlvspace <= 0) AND ($n > 0)) { if (isset($parent['fontsize'])) { - $hbz = $this->getCellHeight($tag['fontsize'] / $this->k); + $hbz = (($parent['fontsize'] / $this->k) * $this->cell_height_ratio); } else { $hbz = $this->getCellHeight($this->FontSize); } @@ -23055,6 +23063,7 @@ Putting 1 is equivalent to putting 0 and calling Ln() just after. Default value: $newgradient = $this->svggradients[$gradient['xref']]; $newgradient['coords'] = $gradient['coords']; $newgradient['mode'] = $gradient['mode']; + $newgradient['type'] = $gradient['type']; $newgradient['gradientUnits'] = $gradient['gradientUnits']; if (isset($gradient['gradientTransform'])) { $newgradient['gradientTransform'] = $gradient['gradientTransform'];