mirror of
https://github.com/tecnickcom/TCPDF.git
synced 2025-01-30 04:17:47 +01:00
5.9.050
This commit is contained in:
parent
307fd09ad6
commit
df894a851f
@ -1,3 +1,6 @@
|
||||
5.9.050 (2011-02-11)
|
||||
- Bug #3177606 "SVG Bar chart error" was fixed.
|
||||
|
||||
5.9.049 (2011-02-03)
|
||||
- Bug #3170777 "TCPDF creates a new page after a single line in writeHTML" was fixed.
|
||||
|
||||
|
@ -8,8 +8,8 @@ http://sourceforge.net/donate/index.php?group_id=128076
|
||||
------------------------------------------------------------
|
||||
|
||||
Name: TCPDF
|
||||
Version: 5.9.049
|
||||
Release date: 2011-02-03
|
||||
Version: 5.9.050
|
||||
Release date: 2011-02-11
|
||||
Author: Nicola Asuni
|
||||
|
||||
Copyright (c) 2002-2011:
|
||||
|
@ -2,7 +2,7 @@
|
||||
//============================================================+
|
||||
// File name : makeallttffonts.php
|
||||
// Begin : 2008-12-07
|
||||
// Last Update : 2010-12-03
|
||||
// Last Update : 2011-02-04
|
||||
//
|
||||
// Description : Process all TTF files on current directory to
|
||||
// build TCPDF compatible font files.
|
||||
@ -40,26 +40,36 @@
|
||||
//============================================================+
|
||||
|
||||
/**
|
||||
* @file
|
||||
* Process all TTF files on current directory to build TCPDF compatible font files.
|
||||
* @package com.tecnick.tcpdf
|
||||
* @author Nicola Asuni
|
||||
* @copyright Copyright © 2004-2009, Nicola Asuni - Tecnick.com S.r.l. - ITALY - www.tecnick.com - info@tecnick.com
|
||||
* @license http://www.gnu.org/copyleft/lesser.html GNU Lesser General Public License
|
||||
* @link www.tecnick.com
|
||||
* @since 2008-12-07
|
||||
*/
|
||||
|
||||
// read directory for files (only TTF files).
|
||||
// read directory for files (only TTF and OTF files).
|
||||
$handle = opendir('.');
|
||||
while ($file = readdir($handle)) {
|
||||
$path_parts = pathinfo($file);
|
||||
if (isset($path_parts['extension']) AND (strtoupper($path_parts['extension']) === 'TTF')) {
|
||||
if (strtoupper(substr(PHP_OS, 0, 3)) === 'WIN') {
|
||||
// windows
|
||||
exec('ttf2ufm.exe -a -F '.$path_parts['basename']);
|
||||
} else {
|
||||
// linux
|
||||
exec('./ttf2ufm -a -F '.$path_parts['basename']);
|
||||
if (isset($path_parts['extension'])) {
|
||||
$fontfile = $path_parts['basename'];
|
||||
$filename = $path_parts['filename'];
|
||||
$extension = strtolower($path_parts['extension']);
|
||||
if (($extension === 'ttf') OR ($extension === 'otf')) {
|
||||
if (!file_exists($filename.'.ufm')) {
|
||||
if (strtoupper(substr(PHP_OS, 0, 3)) === 'WIN') {
|
||||
// windows
|
||||
passthru('ttf2ufm.exe -a -F '.$fontfile);
|
||||
} else {
|
||||
// linux
|
||||
passthru('./ttf2ufm -a -F '.$fontfile);
|
||||
}
|
||||
}
|
||||
$cmd = 'php -q makefont.php '.$fontfile.' '.$filename.'.ufm'; // unicode file
|
||||
passthru($cmd);
|
||||
}
|
||||
exec('php -q makefont.php '.$path_parts['basename'].' '.$path_parts['filename'].'.ufm');
|
||||
}
|
||||
}
|
||||
closedir($handle);
|
||||
|
185
tcpdf.php
185
tcpdf.php
@ -1,9 +1,9 @@
|
||||
<?php
|
||||
//============================================================+
|
||||
// File name : tcpdf.php
|
||||
// Version : 5.9.049
|
||||
// Version : 5.9.050
|
||||
// Begin : 2002-08-03
|
||||
// Last Update : 2011-02-03
|
||||
// Last Update : 2011-02-11
|
||||
// Author : Nicola Asuni - Tecnick.com S.r.l - Via Della Pace, 11 - 09044 - Quartucciu (CA) - ITALY - www.tecnick.com - info@tecnick.com
|
||||
// License : http://www.tecnick.com/pagefiles/tcpdf/LICENSE.TXT GNU-LGPLv3 + YOU CAN'T REMOVE ANY TCPDF COPYRIGHT NOTICE OR LINK FROM THE GENERATED PDF DOCUMENTS.
|
||||
// -------------------------------------------------------------------
|
||||
@ -134,7 +134,7 @@
|
||||
* Tools to encode your unicode fonts are on fonts/utils directory.</p>
|
||||
* @package com.tecnick.tcpdf
|
||||
* @author Nicola Asuni
|
||||
* @version 5.9.049
|
||||
* @version 5.9.050
|
||||
*/
|
||||
|
||||
// Main configuration file. Define the K_TCPDF_EXTERNAL_CONFIG constant to skip this file.
|
||||
@ -146,7 +146,7 @@ require_once(dirname(__FILE__).'/config/tcpdf_config.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>
|
||||
* @package com.tecnick.tcpdf
|
||||
* @brief PHP class for generating PDF documents without requiring external extensions.
|
||||
* @version 5.9.049
|
||||
* @version 5.9.050
|
||||
* @author Nicola Asuni - info@tecnick.com
|
||||
*/
|
||||
class TCPDF {
|
||||
@ -157,7 +157,7 @@ class TCPDF {
|
||||
* Current TCPDF version.
|
||||
* @private
|
||||
*/
|
||||
private $tcpdf_version = '5.9.049';
|
||||
private $tcpdf_version = '5.9.050';
|
||||
|
||||
// Protected properties
|
||||
|
||||
@ -9215,8 +9215,9 @@ class TCPDF {
|
||||
|
||||
/**
|
||||
* Returns a subset of the TrueType font data without the unused glyphs.
|
||||
* @param $font (string) TrueType font data
|
||||
* @param $subsetchars (array) array of used characters (the glyphs to keep)
|
||||
* @param $font (string) TrueType font data.
|
||||
* @param $subsetchars (array) Array of used characters (the glyphs to keep).
|
||||
* @param $cmap (boolean) If true add a CMAP table on font description.
|
||||
* @return string a subset of TrueType font data without the unused glyphs
|
||||
* @author Nicola Asuni
|
||||
* @protected
|
||||
@ -9468,7 +9469,7 @@ class TCPDF {
|
||||
}
|
||||
}
|
||||
// array of table names to preserve (loca and glyf tables will be added later)
|
||||
//$table_names = array ('cmap', 'head', 'hhea', 'hmtx', 'maxp', 'name', 'OS/2', 'post', 'cvt ', 'fpgm', 'prep');
|
||||
// additional maps includes: 'cmap', 'head', 'name', 'OS/2', 'post';
|
||||
// the cmap table is not needed and shall not be present, since the mapping from character codes to glyph descriptions is provided separately
|
||||
$table_names = array ('head', 'hhea', 'hmtx', 'maxp', 'cvt ', 'fpgm', 'prep'); // minimum required table names
|
||||
// get the tables to preserve
|
||||
@ -25012,6 +25013,7 @@ Putting 1 is equivalent to putting 0 and calling Ln() just after. Default value:
|
||||
*/
|
||||
protected function setSVGStyles($svgstyle, $prevsvgstyle, $x=0, $y=0, $w=1, $h=1, $clip_function='', $clip_params=array()) {
|
||||
$objstyle = '';
|
||||
$minlen = (0.01 / $this->k); // minimum acceptable lenght (3 point)
|
||||
if(!isset($svgstyle['opacity'])) {
|
||||
return $objstyle;
|
||||
}
|
||||
@ -25107,11 +25109,11 @@ Putting 1 is equivalent to putting 0 and calling Ln() just after. Default value:
|
||||
$gradient['coords'][2] += $x;
|
||||
$gradient['coords'][3] += $y;
|
||||
}
|
||||
if ($w <= 0) {
|
||||
$w = 1;
|
||||
if ($w <= $minlen) {
|
||||
$w = $minlen;
|
||||
}
|
||||
if ($h <= 0) {
|
||||
$h = 1;
|
||||
if ($h <= $minlen) {
|
||||
$h = $minlen;
|
||||
}
|
||||
// calculate percentages
|
||||
$gradient['coords'][0] = ($gradient['coords'][0] - $x) / $w;
|
||||
@ -25310,6 +25312,7 @@ Putting 1 is equivalent to putting 0 and calling Ln() just after. Default value:
|
||||
$ymin = 2147483647;
|
||||
$ymax = 0;
|
||||
$relcoord = false;
|
||||
$minlen = (0.01 / $this->k); // minimum acceptable lenght (3 point)
|
||||
// draw curve pieces
|
||||
foreach ($paths as $key => $val) {
|
||||
// get curve type
|
||||
@ -25331,8 +25334,15 @@ Putting 1 is equivalent to putting 0 and calling Ln() just after. Default value:
|
||||
$params = array();
|
||||
foreach ($rawparams as $ck => $cp) {
|
||||
$params[$ck] = $this->getHTMLUnitToUnits($cp, 0, $this->svgunit, false);
|
||||
if (abs($params[$ck]) < $minlen) {
|
||||
// aproximate little values to zero
|
||||
$params[$ck] = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
// store current origin point
|
||||
$x0 = $x;
|
||||
$y0 = $y;
|
||||
switch (strtoupper($cmd)) {
|
||||
case 'M': { // moveto
|
||||
foreach ($params as $ck => $cp) {
|
||||
@ -25340,10 +25350,12 @@ Putting 1 is equivalent to putting 0 and calling Ln() just after. Default value:
|
||||
$x = $cp + $xoffset;
|
||||
} else {
|
||||
$y = $cp + $yoffset;
|
||||
if ($ck == 1) {
|
||||
$this->_outPoint($x, $y);
|
||||
} else {
|
||||
$this->_outLine($x, $y);
|
||||
if ((abs($x0 - $x) >= $minlen) OR (abs($y0 - $y) >= $minlen)) {
|
||||
if ($ck == 1) {
|
||||
$this->_outPoint($x, $y);
|
||||
} else {
|
||||
$this->_outLine($x, $y);
|
||||
}
|
||||
}
|
||||
$xmin = min($xmin, $x);
|
||||
$ymin = min($ymin, $y);
|
||||
@ -25363,7 +25375,9 @@ Putting 1 is equivalent to putting 0 and calling Ln() just after. Default value:
|
||||
$x = $cp + $xoffset;
|
||||
} else {
|
||||
$y = $cp + $yoffset;
|
||||
$this->_outLine($x, $y);
|
||||
if ((abs($x0 - $x) >= $minlen) OR (abs($y0 - $y) >= $minlen)) {
|
||||
$this->_outLine($x, $y);
|
||||
}
|
||||
$xmin = min($xmin, $x);
|
||||
$ymin = min($ymin, $y);
|
||||
$xmax = max($xmax, $x);
|
||||
@ -25379,7 +25393,9 @@ Putting 1 is equivalent to putting 0 and calling Ln() just after. Default value:
|
||||
case 'H': { // horizontal lineto
|
||||
foreach ($params as $ck => $cp) {
|
||||
$x = $cp + $xoffset;
|
||||
$this->_outLine($x, $y);
|
||||
if ((abs($x0 - $x) >= $minlen) OR (abs($y0 - $y) >= $minlen)) {
|
||||
$this->_outLine($x, $y);
|
||||
}
|
||||
$xmin = min($xmin, $x);
|
||||
$xmax = max($xmax, $x);
|
||||
if ($relcoord) {
|
||||
@ -25391,7 +25407,9 @@ Putting 1 is equivalent to putting 0 and calling Ln() just after. Default value:
|
||||
case 'V': { // vertical lineto
|
||||
foreach ($params as $ck => $cp) {
|
||||
$y = $cp + $yoffset;
|
||||
$this->_outLine($x, $y);
|
||||
if ((abs($x0 - $x) >= $minlen) OR (abs($y0 - $y) >= $minlen)) {
|
||||
$this->_outLine($x, $y);
|
||||
}
|
||||
$ymin = min($ymin, $y);
|
||||
$ymax = max($ymax, $y);
|
||||
if ($relcoord) {
|
||||
@ -25522,73 +25540,76 @@ Putting 1 is equivalent to putting 0 and calling Ln() just after. Default value:
|
||||
$fs = $rawparams[($ck - 2)]; // sweep-flag
|
||||
$x = $params[($ck - 1)] + $xoffset;
|
||||
$y = $params[$ck] + $yoffset;
|
||||
$minlen = (0.01 / $this->k); // 3 point
|
||||
if ((abs($x0 - $x) < $minlen) AND (abs($x0 - $x) < $minlen)) {
|
||||
if ((abs($x0 - $x) < $minlen) AND (abs($y0 - $y) < $minlen)) {
|
||||
// endpoints are almost identical
|
||||
break;
|
||||
}
|
||||
$cos_ang = cos($angle);
|
||||
$sin_ang = sin($angle);
|
||||
$a = (($x0 - $x) / 2);
|
||||
$b = (($y0 - $y) / 2);
|
||||
$xa = ($a * $cos_ang) - ($b * $sin_ang);
|
||||
$ya = ($a * $sin_ang) + ($b * $cos_ang);
|
||||
$rx2 = $rx * $rx;
|
||||
$ry2 = $ry * $ry;
|
||||
$xa2 = $xa * $xa;
|
||||
$ya2 = $ya * $ya;
|
||||
$delta = ($xa2 / $rx2) + ($ya2 / $ry2);
|
||||
if ($delta > 1) {
|
||||
$rx *= sqrt($delta);
|
||||
$ry *= sqrt($delta);
|
||||
$xmin = min($xmin, $x);
|
||||
$ymin = min($ymin, $y);
|
||||
$xmax = max($xmax, $x);
|
||||
$ymax = max($ymax, $y);
|
||||
} else {
|
||||
$cos_ang = cos($angle);
|
||||
$sin_ang = sin($angle);
|
||||
$a = (($x0 - $x) / 2);
|
||||
$b = (($y0 - $y) / 2);
|
||||
$xa = ($a * $cos_ang) - ($b * $sin_ang);
|
||||
$ya = ($a * $sin_ang) + ($b * $cos_ang);
|
||||
$rx2 = $rx * $rx;
|
||||
$ry2 = $ry * $ry;
|
||||
$xa2 = $xa * $xa;
|
||||
$ya2 = $ya * $ya;
|
||||
$delta = ($xa2 / $rx2) + ($ya2 / $ry2);
|
||||
if ($delta > 1) {
|
||||
$rx *= sqrt($delta);
|
||||
$ry *= sqrt($delta);
|
||||
$rx2 = $rx * $rx;
|
||||
$ry2 = $ry * $ry;
|
||||
}
|
||||
$numerator = (($rx2 * $ry2) - ($rx2 * $ya2) - ($ry2 * $xa2));
|
||||
if ($numerator < 0) {
|
||||
$root = 0;
|
||||
} else {
|
||||
$root = sqrt($numerator / (($rx2 * $ya2) + ($ry2 * $xa2)));
|
||||
}
|
||||
if ($fa == $fs){
|
||||
$root *= -1;
|
||||
}
|
||||
$cax = $root * (($rx * $ya) / $ry);
|
||||
$cay = -$root * (($ry * $xa) / $rx);
|
||||
// coordinates of ellipse center
|
||||
$cx = ($cax * $cos_ang) - ($cay * $sin_ang) + (($x0 + $x) / 2);
|
||||
$cy = ($cax * $sin_ang) + ($cay * $cos_ang) + (($y0 + $y) / 2);
|
||||
// get angles
|
||||
$angs = $this->getVectorsAngle(1, 0, (($xa - $cax) / $rx), (($cay - $ya) / $ry));
|
||||
$dang = $this->getVectorsAngle((($xa - $cax) / $rx), (($ya - $cay) / $ry), ((-$xa - $cax) / $rx), ((-$ya - $cay) / $ry));
|
||||
if (($fs == 0) AND ($dang > 0)) {
|
||||
$dang -= (2 * M_PI);
|
||||
} elseif (($fs == 1) AND ($dang < 0)) {
|
||||
$dang += (2 * M_PI);
|
||||
}
|
||||
$angf = $angs - $dang;
|
||||
if ((($fs == 0) AND ($angs > $angf)) OR (($fs == 1) AND ($angs < $angf))) {
|
||||
// reverse angles
|
||||
$tmp = $angs;
|
||||
$angs = $angf;
|
||||
$angf = $tmp;
|
||||
}
|
||||
$angs = round(rad2deg($angs), 6);
|
||||
$angf = round(rad2deg($angf), 6);
|
||||
// covent angles to positive values
|
||||
if (($angs < 0) AND ($angf < 0)) {
|
||||
$angs += 360;
|
||||
$angf += 360;
|
||||
}
|
||||
$pie = false;
|
||||
if (($key == 0) AND (isset($paths[($key + 1)][1])) AND (trim($paths[($key + 1)][1]) == 'z')) {
|
||||
$pie = true;
|
||||
}
|
||||
list($axmin, $aymin, $axmax, $aymax) = $this->_outellipticalarc($cx, $cy, $rx, $ry, $ang, $angs, $angf, $pie, 2, false, ($fs == 0), true);
|
||||
$xmin = min($xmin, $x, $axmin);
|
||||
$ymin = min($ymin, $y, $aymin);
|
||||
$xmax = max($xmax, $x, $axmax);
|
||||
$ymax = max($ymax, $y, $aymax);
|
||||
}
|
||||
$numerator = (($rx2 * $ry2) - ($rx2 * $ya2) - ($ry2 * $xa2));
|
||||
if ($numerator < 0) {
|
||||
$root = 0;
|
||||
} else {
|
||||
$root = sqrt($numerator / (($rx2 * $ya2) + ($ry2 * $xa2)));
|
||||
}
|
||||
if ($fa == $fs){
|
||||
$root *= -1;
|
||||
}
|
||||
$cax = $root * (($rx * $ya) / $ry);
|
||||
$cay = -$root * (($ry * $xa) / $rx);
|
||||
// coordinates of ellipse center
|
||||
$cx = ($cax * $cos_ang) - ($cay * $sin_ang) + (($x0 + $x) / 2);
|
||||
$cy = ($cax * $sin_ang) + ($cay * $cos_ang) + (($y0 + $y) / 2);
|
||||
// get angles
|
||||
$angs = $this->getVectorsAngle(1, 0, (($xa - $cax) / $rx), (($cay - $ya) / $ry));
|
||||
$dang = $this->getVectorsAngle((($xa - $cax) / $rx), (($ya - $cay) / $ry), ((-$xa - $cax) / $rx), ((-$ya - $cay) / $ry));
|
||||
if (($fs == 0) AND ($dang > 0)) {
|
||||
$dang -= (2 * M_PI);
|
||||
} elseif (($fs == 1) AND ($dang < 0)) {
|
||||
$dang += (2 * M_PI);
|
||||
}
|
||||
$angf = $angs - $dang;
|
||||
if ((($fs == 0) AND ($angs > $angf)) OR (($fs == 1) AND ($angs < $angf))) {
|
||||
// reverse angles
|
||||
$tmp = $angs;
|
||||
$angs = $angf;
|
||||
$angf = $tmp;
|
||||
}
|
||||
$angs = round(rad2deg($angs), 6);
|
||||
$angf = round(rad2deg($angf), 6);
|
||||
// covent angles to positive values
|
||||
if (($angs < 0) AND ($angf < 0)) {
|
||||
$angs += 360;
|
||||
$angf += 360;
|
||||
}
|
||||
$pie = false;
|
||||
if (($key == 0) AND (isset($paths[($key + 1)][1])) AND (trim($paths[($key + 1)][1]) == 'z')) {
|
||||
$pie = true;
|
||||
}
|
||||
list($axmin, $aymin, $axmax, $aymax) = $this->_outellipticalarc($cx, $cy, $rx, $ry, $ang, $angs, $angf, $pie, 2, false, ($fs == 0), true);
|
||||
$xmin = min($xmin, $x, $axmin);
|
||||
$ymin = min($ymin, $y, $aymin);
|
||||
$xmax = max($xmax, $x, $axmax);
|
||||
$ymax = max($ymax, $y, $aymax);
|
||||
if ($relcoord) {
|
||||
$xoffset = $x;
|
||||
$yoffset = $y;
|
||||
|
Loading…
x
Reference in New Issue
Block a user