From f40c7e4165292d87cdb9246afbd79827a9c285c1 Mon Sep 17 00:00:00 2001 From: nicolaasuni Date: Sat, 3 May 2014 14:34:00 +0100 Subject: [PATCH] 6.0.074 (2014-05-03) - Bug #917 "Using realtive Units like ex or em for images distort output in HTML mode" was fixed. - Bug #915 "Problem with SVG Image using Radial Gradients" was fixed. --- CHANGELOG.TXT | 4 ++++ README.TXT | 4 ++-- composer.json | 2 +- include/tcpdf_static.php | 2 +- tcpdf.php | 45 ++++++++++++++++++++-------------------- 5 files changed, 30 insertions(+), 27 deletions(-) diff --git a/CHANGELOG.TXT b/CHANGELOG.TXT index 7446cdc..6d180ce 100644 --- a/CHANGELOG.TXT +++ b/CHANGELOG.TXT @@ -1,3 +1,7 @@ +6.0.074 (2014-05-03) + - Bug #917 "Using realtive Units like ex or em for images distort output in HTML mode" was fixed. + - Bug #915 "Problem with SVG Image using Radial Gradients" was fixed. + 6.0.073 (2014-04-29) - Bug #913 "Possible bug with line-height" was fixed. - Bug #914 "MultiCell and FitCell" was fixed. diff --git a/README.TXT b/README.TXT index 9c39745..859d940 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.073 -Release date: 2014-04-29 +Version: 6.0.074 +Release date: 2014-05-03 Author: Nicola Asuni Copyright (c) 2002-2014: diff --git a/composer.json b/composer.json index a846d6c..b1decd6 100644 --- a/composer.json +++ b/composer.json @@ -1,6 +1,6 @@ { "name": "tecnick.com/tcpdf", - "version": "6.0.073", + "version": "6.0.074", "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 5b283a6..018e901 100644 --- a/include/tcpdf_static.php +++ b/include/tcpdf_static.php @@ -55,7 +55,7 @@ class TCPDF_STATIC { * Current TCPDF version. * @private static */ - private static $tcpdf_version = '6.0.073'; + private static $tcpdf_version = '6.0.074'; /** * String alias for total number of pages. diff --git a/tcpdf.php b/tcpdf.php index f48b7e3..1be17e3 100644 --- a/tcpdf.php +++ b/tcpdf.php @@ -1,9 +1,9 @@ * @package com.tecnick.tcpdf * @author Nicola Asuni - * @version 6.0.073 + * @version 6.0.074 */ // 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.073 + * @version 6.0.074 * @author Nicola Asuni - info@tecnick.com */ class TCPDF { @@ -2418,7 +2418,7 @@ class TCPDF { if ($padding) { $height += ($this->cell_padding['T'] + $this->cell_padding['B']); } - return round($height, 3); + return round($height, 6); } /** @@ -17295,9 +17295,9 @@ Putting 1 is equivalent to putting 0 and calling Ln() just after. Default value: // vertically align image in line if ((!$this->newline) AND ($dom[$key]['value'] == 'img') AND (isset($dom[$key]['height'])) AND ($dom[$key]['height'] > 0)) { // get image height - $imgh = $this->getHTMLUnitToUnits($dom[$key]['height'], $this->lasth, 'px'); + $imgh = $this->getHTMLUnitToUnits($dom[$key]['height'], 1, 'px'); $autolinebreak = false; - if (isset($dom[$key]['width']) AND ($dom[$key]['width'] > 0)) { + if (!empty($dom[$key]['width'])) { $imgw = $this->getHTMLUnitToUnits($dom[$key]['width'], 1, 'px', false); if (($imgw <= ($this->w - $this->lMargin - $this->rMargin - $this->cell_padding['L'] - $this->cell_padding['R'])) AND ((($this->rtl) AND (($this->x - $imgw) < ($this->lMargin + $this->cell_padding['L']))) @@ -17364,9 +17364,9 @@ Putting 1 is equivalent to putting 0 and calling Ln() just after. Default value: $startliney = $this->y; $this->newline = false; } - $this->y += (($this->getCellHeight($curfontsize / $this->k) + $curfontascent - $curfontdescent) / 2) - $imgh; + $this->y += ($this->getCellHeight($curfontsize / $this->k) - ($curfontdescent * $this->cell_height_ratio) - $imgh); $minstartliney = min($this->y, $minstartliney); - $maxbottomliney = ($startliney + $this->getCellHeight($this->FontSize)); + $maxbottomliney = ($startliney + $this->getCellHeight($curfontsize / $this->k)); } } elseif (isset($dom[$key]['fontname']) OR isset($dom[$key]['fontstyle']) OR isset($dom[$key]['fontsize']) OR isset($dom[$key]['line-height'])) { // account for different font size @@ -23014,7 +23014,7 @@ Putting 1 is equivalent to putting 0 and calling Ln() just after. Default value: return; } $objstyle = ''; - $minlen = (0.01 / $this->k); // minimum acceptable length (3 point) + $minlen = (0.01 / $this->k); // minimum acceptable length if (!isset($svgstyle['opacity'])) { return $objstyle; } @@ -23075,11 +23075,14 @@ Putting 1 is equivalent to putting 0 and calling Ln() just after. Default value: //set clipping area if (!empty($clip_function) AND method_exists($this, $clip_function)) { $bbox = call_user_func_array(array($this, $clip_function), $clip_params); - if (is_array($bbox) AND (count($bbox) == 4)) { + if ((!isset($gradient['type']) OR ($gradient['type'] != 3)) AND is_array($bbox) AND (count($bbox) == 4)) { list($x, $y, $w, $h) = $bbox; } } if ($gradient['mode'] == 'measure') { + if (!isset($gradient['coords'][4])) { + $gradient['coords'][4] = 0.5; + } if (isset($gradient['gradientTransform']) AND !empty($gradient['gradientTransform'])) { $gtm = $gradient['gradientTransform']; // apply transformation matrix @@ -23087,22 +23090,19 @@ Putting 1 is equivalent to putting 0 and calling Ln() just after. Default value: $ya = ($gtm[1] * $gradient['coords'][0]) + ($gtm[3] * $gradient['coords'][1]) + $gtm[5]; $xb = ($gtm[0] * $gradient['coords'][2]) + ($gtm[2] * $gradient['coords'][3]) + $gtm[4]; $yb = ($gtm[1] * $gradient['coords'][2]) + ($gtm[3] * $gradient['coords'][3]) + $gtm[5]; - if (isset($gradient['coords'][4])) { - $gradient['coords'][4] = sqrt(pow(($gtm[0] * $gradient['coords'][4]), 2) + pow(($gtm[1] * $gradient['coords'][4]), 2)); - } + $r = sqrt(pow(($gtm[0] * $gradient['coords'][4]), 2) + pow(($gtm[1] * $gradient['coords'][4]), 2)); $gradient['coords'][0] = $xa; $gradient['coords'][1] = $ya; $gradient['coords'][2] = $xb; $gradient['coords'][3] = $yb; + $gradient['coords'][4] = $r; } // convert SVG coordinates to user units $gradient['coords'][0] = $this->getHTMLUnitToUnits($gradient['coords'][0], 0, $this->svgunit, false); $gradient['coords'][1] = $this->getHTMLUnitToUnits($gradient['coords'][1], 0, $this->svgunit, false); $gradient['coords'][2] = $this->getHTMLUnitToUnits($gradient['coords'][2], 0, $this->svgunit, false); $gradient['coords'][3] = $this->getHTMLUnitToUnits($gradient['coords'][3], 0, $this->svgunit, false); - if (isset($gradient['coords'][4])) { - $gradient['coords'][4] = $this->getHTMLUnitToUnits($gradient['coords'][4], 0, $this->svgunit, false); - } + $gradient['coords'][4] = $this->getHTMLUnitToUnits($gradient['coords'][4], 0, $this->svgunit, false); if ($w <= $minlen) { $w = $minlen; } @@ -23122,9 +23122,7 @@ Putting 1 is equivalent to putting 0 and calling Ln() just after. Default value: $gradient['coords'][1] = (($gradient['coords'][1] - $y) / $h); $gradient['coords'][2] = (($gradient['coords'][2] - $x) / $w); $gradient['coords'][3] = (($gradient['coords'][3] - $y) / $h); - if (isset($gradient['coords'][4])) { - $gradient['coords'][4] /= $w; - } + $gradient['coords'][4] /= $w; } elseif ($gradient['mode'] == 'percentage') { foreach($gradient['coords'] as $key => $val) { $gradient['coords'][$key] = (intval($val) / 100); @@ -23147,13 +23145,14 @@ Putting 1 is equivalent to putting 0 and calling Ln() just after. Default value: $gradient['coords'][1] = $gradient['coords'][3]; $gradient['coords'][3] = $tmp; // set transformation map for gradient + $cy = ($this->h - $y); if ($gradient['type'] == 3) { // circular gradient - $cy = $this->h - $y - ($gradient['coords'][1] * ($w + $h)); - $this->_out(sprintf('%F 0 0 %F %F %F cm', ($w * $this->k), ($w * $this->k), ($x * $this->k), ($cy * $this->k))); + $cy -= ($gradient['coords'][1] * ($w + $h)); } else { - $this->_out(sprintf('%F 0 0 %F %F %F cm', ($w * $this->k), ($h * $this->k), ($x * $this->k), (($this->h - ($y + $h)) * $this->k))); + $cy -= $h; } + $this->_out(sprintf('%F 0 0 %F %F %F cm', ($w * $this->k), ($h * $this->k), ($x * $this->k), ($cy * $this->k))); if (count($gradient['stops']) > 1) { $this->Gradient($gradient['type'], $gradient['coords'], $gradient['stops'], array(), false); }