32
1
mirror of https://github.com/vdm-io/tcpdf.git synced 2024-11-25 22:07:33 +00:00

6.0.047 (2013-11-19)

- SVG support was extended to support some nested defs.
This commit is contained in:
nicolaasuni 2013-11-19 22:20:54 +00:00
parent 22518a0546
commit acb0db3a6d
5 changed files with 59 additions and 14 deletions

View File

@ -1,3 +1,6 @@
6.0.047 (2013-11-19)
- SVG support was extended to support some nested defs.
6.0.046 (2013-11-17) 6.0.046 (2013-11-17)
- preg_replace_callback functions were replaced to improve memory performances. - preg_replace_callback functions were replaced to improve memory performances.

View File

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

View File

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

View File

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

View File

@ -1,9 +1,9 @@
<?php <?php
//============================================================+ //============================================================+
// File name : tcpdf.php // File name : tcpdf.php
// Version : 6.0.046 // Version : 6.0.047
// Begin : 2002-08-03 // Begin : 2002-08-03
// Last Update : 2013-11-17 // Last Update : 2013-11-19
// Author : Nicola Asuni - Tecnick.com LTD - www.tecnick.com - info@tecnick.com // Author : Nicola Asuni - Tecnick.com LTD - www.tecnick.com - info@tecnick.com
// License : GNU-LGPL v3 (http://www.gnu.org/copyleft/lesser.html) // License : GNU-LGPL v3 (http://www.gnu.org/copyleft/lesser.html)
// ------------------------------------------------------------------- // -------------------------------------------------------------------
@ -104,7 +104,7 @@
* Tools to encode your unicode fonts are on fonts/utils directory.</p> * Tools to encode your unicode fonts are on fonts/utils directory.</p>
* @package com.tecnick.tcpdf * @package com.tecnick.tcpdf
* @author Nicola Asuni * @author Nicola Asuni
* @version 6.0.046 * @version 6.0.047
*/ */
// TCPDF configuration // 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> * 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 * @package com.tecnick.tcpdf
* @brief PHP class for generating PDF documents without requiring external extensions. * @brief PHP class for generating PDF documents without requiring external extensions.
* @version 6.0.046 * @version 6.0.047
* @author Nicola Asuni - info@tecnick.com * @author Nicola Asuni - info@tecnick.com
*/ */
class TCPDF { class TCPDF {
@ -23538,10 +23538,19 @@ Putting 1 is equivalent to putting 0 and calling Ln() just after. Default value:
return; return;
} }
if ($this->svgdefsmode AND !in_array($name, array('clipPath', 'linearGradient', 'radialGradient', 'stop'))) { if ($this->svgdefsmode AND !in_array($name, array('clipPath', 'linearGradient', 'radialGradient', 'stop'))) {
if (!isset($attribs['id'])) { if (isset($attribs['id'])) {
$attribs['id'] = 'DF_'.(count($this->svgdefs) + 1); $attribs['child_elements'] = array();
$this->svgdefs[$attribs['id']] = array('name' => $name, 'attribs' => $attribs);
return;
}
if (end($this->svgdefs) !== FALSE) {
$last_svgdefs_id = key($this->svgdefs);
if (isset($this->svgdefs[$last_svgdefs_id]['attribs']['child_elements'])) {
$attribs['id'] = 'DF_'.(count($this->svgdefs) + 1);
$this->svgdefs[$last_svgdefs_id]['attribs']['child_elements'][$attribs['id']] = array('name' => $name, 'attribs' => $attribs);
return;
}
} }
$this->svgdefs[$attribs['id']] = array('name' => $name, 'attribs' => $attribs);
return; return;
} }
$clipping = false; $clipping = false;
@ -23550,7 +23559,7 @@ Putting 1 is equivalent to putting 0 and calling Ln() just after. Default value:
$clipping = true; $clipping = true;
} }
// get styling properties // get styling properties
$prev_svgstyle = $this->svgstyles[(count($this->svgstyles) - 1)]; // previous style $prev_svgstyle = $this->svgstyles[max(0,(count($this->svgstyles) - 1))]; // previous style
$svgstyle = $this->svgstyles[0]; // set default style $svgstyle = $this->svgstyles[0]; // set default style
if ($clipping AND !isset($attribs['fill']) AND (!isset($attribs['style']) OR (!preg_match('/[;\"\s]{1}fill[\s]*:[\s]*([^;\"]*)/si', $attribs['style'], $attrval)))) { if ($clipping AND !isset($attribs['fill']) AND (!isset($attribs['style']) OR (!preg_match('/[;\"\s]{1}fill[\s]*:[\s]*([^;\"]*)/si', $attribs['style'], $attrval)))) {
// default fill attribute for clipping // default fill attribute for clipping
@ -24040,7 +24049,8 @@ Putting 1 is equivalent to putting 0 and calling Ln() just after. Default value:
$attribs['y'] += $use['attribs']['y']; $attribs['y'] += $use['attribs']['y'];
} }
$attribs = array_merge($use['attribs'], $attribs); $attribs = array_merge($use['attribs'], $attribs);
$this->startSVGElementHandler($parser, $use['name'], $attribs); $this->startSVGElementHandler('use-tag', $use['name'], $attribs);
return;
} }
} }
break; break;
@ -24049,6 +24059,18 @@ Putting 1 is equivalent to putting 0 and calling Ln() just after. Default value:
break; break;
} }
} // end of switch } // end of switch
// process child elements
if (!empty($attribs['child_elements'])) {
$child_elements = $attribs['child_elements'];
unset($attribs['child_elements']);
foreach($child_elements as $child_element) {
if (empty($child_element['attribs']['closing_tag'])) {
$this->startSVGElementHandler('child-tag', $child_element['name'], $child_element['attribs']);
} else {
$this->endSVGElementHandler('child-tag', $child_element['name']);
}
}
}
} }
/** /**
@ -24060,6 +24082,24 @@ Putting 1 is equivalent to putting 0 and calling Ln() just after. Default value:
* @protected * @protected
*/ */
protected function endSVGElementHandler($parser, $name) { protected function endSVGElementHandler($parser, $name) {
if ($this->svgdefsmode AND !in_array($name, array('defs', 'clipPath', 'linearGradient', 'radialGradient', 'stop'))) {;
if (end($this->svgdefs) !== FALSE) {
$last_svgdefs_id = key($this->svgdefs);
if (isset($this->svgdefs[$last_svgdefs_id]['attribs']['child_elements'])) {
foreach($this->svgdefs[$last_svgdefs_id]['attribs']['child_elements'] as $child_element) {
if (isset($child_element['attribs']['id']) AND ($child_element['name'] == $name)) {
$this->svgdefs[$last_svgdefs_id]['attribs']['child_elements'][$child_element['attribs']['id'].'_CLOSE'] = array('name' => $name, 'attribs' => array('closing_tag' => TRUE));
return;
}
}
if ($this->svgdefs[$last_svgdefs_id]['name'] == $name) {
$this->svgdefs[$last_svgdefs_id]['attribs']['child_elements'][$last_svgdefs_id.'_CLOSE'] = array('name' => $name, 'attribs' => array('closing_tag' => TRUE));
return;
}
}
}
return;
}
switch($name) { switch($name) {
case 'defs': { case 'defs': {
$this->svgdefsmode = false; $this->svgdefsmode = false;
@ -24122,7 +24162,9 @@ Putting 1 is equivalent to putting 0 and calling Ln() just after. Default value:
$this->textstrokewidth = $textstrokewidth; $this->textstrokewidth = $textstrokewidth;
$this->svgtext = ''; $this->svgtext = '';
$this->StopTransform(); $this->StopTransform();
array_pop($this->svgstyles); if (!$this->svgdefsmode) {
array_pop($this->svgstyles);
}
break; break;
} }
default: { default: {