Updating TCPDF library
This commit is contained in:
parent
1a57ad7292
commit
052824e4b7
28 changed files with 33338 additions and 968 deletions
|
@ -720,6 +720,7 @@ class QRcode {
|
|||
protected function encodeMask($mask) {
|
||||
$spec = array(0, 0, 0, 0, 0);
|
||||
$this->datacode = $this->getByteStream($this->items);
|
||||
|
||||
if (is_null($this->datacode)) {
|
||||
return NULL;
|
||||
}
|
||||
|
|
Binary file not shown.
|
@ -154,7 +154,7 @@ class TCPDF_FONTS {
|
|||
$enc_target = TCPDF_FONT_DATA::$encmap[$enc];
|
||||
$last = 0;
|
||||
for ($i = 32; $i <= 255; ++$i) {
|
||||
if ($enc_target != $enc_ref[$i]) {
|
||||
if ($enc_target[$i] != $enc_ref[$i]) {
|
||||
if ($i != ($last + 1)) {
|
||||
$fmetric['diff'] .= $i.' ';
|
||||
}
|
||||
|
@ -1490,6 +1490,171 @@ class TCPDF_FONTS {
|
|||
return '/W ['.$w.' ]';
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Update the CIDToGIDMap string with a new value.
|
||||
* @param $map (string) CIDToGIDMap.
|
||||
* @param $cid (int) CID value.
|
||||
* @param $gid (int) GID value.
|
||||
* @return (string) CIDToGIDMap.
|
||||
* @author Nicola Asuni
|
||||
* @since 5.9.123 (2011-09-29)
|
||||
* @public static
|
||||
*/
|
||||
public static function updateCIDtoGIDmap($map, $cid, $gid) {
|
||||
if (($cid >= 0) AND ($cid <= 0xFFFF) AND ($gid >= 0)) {
|
||||
if ($gid > 0xFFFF) {
|
||||
$gid -= 0x10000;
|
||||
}
|
||||
$map[($cid * 2)] = chr($gid >> 8);
|
||||
$map[(($cid * 2) + 1)] = chr($gid & 0xFF);
|
||||
}
|
||||
return $map;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return fonts path
|
||||
* @return string
|
||||
* @public static
|
||||
*/
|
||||
public static function _getfontpath() {
|
||||
if (!defined('K_PATH_FONTS') AND is_dir($fdir = realpath(dirname(__FILE__).'/../fonts'))) {
|
||||
if (substr($fdir, -1) != '/') {
|
||||
$fdir .= '/';
|
||||
}
|
||||
define('K_PATH_FONTS', $fdir);
|
||||
}
|
||||
return defined('K_PATH_FONTS') ? K_PATH_FONTS : '';
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Return font full path
|
||||
* @param $file (string) Font file name.
|
||||
* @param $fontdir (string) Font directory (set to false fto search on default directories)
|
||||
* @return string Font full path or empty string
|
||||
* @author Nicola Asuni
|
||||
* @since 6.0.025
|
||||
* @public static
|
||||
*/
|
||||
public static function getFontFullPath($file, $fontdir=false) {
|
||||
$fontfile = '';
|
||||
// search files on various directories
|
||||
if (($fontdir !== false) AND @file_exists($fontdir.$file)) {
|
||||
$fontfile = $fontdir.$file;
|
||||
} elseif (@file_exists(self::_getfontpath().$file)) {
|
||||
$fontfile = self::_getfontpath().$file;
|
||||
} elseif (@file_exists($file)) {
|
||||
$fontfile = $file;
|
||||
}
|
||||
return $fontfile;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Get a reference font size.
|
||||
* @param $size (string) String containing font size value.
|
||||
* @param $refsize (float) Reference font size in points.
|
||||
* @return float value in points
|
||||
* @public static
|
||||
*/
|
||||
public static function getFontRefSize($size, $refsize=12) {
|
||||
switch ($size) {
|
||||
case 'xx-small': {
|
||||
$size = ($refsize - 4);
|
||||
break;
|
||||
}
|
||||
case 'x-small': {
|
||||
$size = ($refsize - 3);
|
||||
break;
|
||||
}
|
||||
case 'small': {
|
||||
$size = ($refsize - 2);
|
||||
break;
|
||||
}
|
||||
case 'medium': {
|
||||
$size = $refsize;
|
||||
break;
|
||||
}
|
||||
case 'large': {
|
||||
$size = ($refsize + 2);
|
||||
break;
|
||||
}
|
||||
case 'x-large': {
|
||||
$size = ($refsize + 4);
|
||||
break;
|
||||
}
|
||||
case 'xx-large': {
|
||||
$size = ($refsize + 6);
|
||||
break;
|
||||
}
|
||||
case 'smaller': {
|
||||
$size = ($refsize - 3);
|
||||
break;
|
||||
}
|
||||
case 'larger': {
|
||||
$size = ($refsize + 3);
|
||||
break;
|
||||
}
|
||||
}
|
||||
return $size;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
// ====================================================================================================================
|
||||
// REIMPLEMENTED
|
||||
// ====================================================================================================================
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Returns the unicode caracter specified by the value
|
||||
* @param $c (int) UTF-8 value
|
||||
|
@ -1663,64 +1828,6 @@ class TCPDF_FONTS {
|
|||
return $string;
|
||||
}
|
||||
|
||||
/**
|
||||
* Update the CIDToGIDMap string with a new value.
|
||||
* @param $map (string) CIDToGIDMap.
|
||||
* @param $cid (int) CID value.
|
||||
* @param $gid (int) GID value.
|
||||
* @return (string) CIDToGIDMap.
|
||||
* @author Nicola Asuni
|
||||
* @since 5.9.123 (2011-09-29)
|
||||
* @public static
|
||||
*/
|
||||
public static function updateCIDtoGIDmap($map, $cid, $gid) {
|
||||
if (($cid >= 0) AND ($cid <= 0xFFFF) AND ($gid >= 0)) {
|
||||
if ($gid > 0xFFFF) {
|
||||
$gid -= 0x10000;
|
||||
}
|
||||
$map[($cid * 2)] = chr($gid >> 8);
|
||||
$map[(($cid * 2) + 1)] = chr($gid & 0xFF);
|
||||
}
|
||||
return $map;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return fonts path
|
||||
* @return string
|
||||
* @public static
|
||||
*/
|
||||
public static function _getfontpath() {
|
||||
if (!defined('K_PATH_FONTS') AND is_dir($fdir = realpath(dirname(__FILE__).'/../fonts'))) {
|
||||
if (substr($fdir, -1) != '/') {
|
||||
$fdir .= '/';
|
||||
}
|
||||
define('K_PATH_FONTS', $fdir);
|
||||
}
|
||||
return defined('K_PATH_FONTS') ? K_PATH_FONTS : '';
|
||||
}
|
||||
|
||||
/**
|
||||
* Return font full path
|
||||
* @param $file (string) Font file name.
|
||||
* @param $fontdir (string) Font directory (set to false fto search on default directories)
|
||||
* @return string Font full path or empty string
|
||||
* @author Nicola Asuni
|
||||
* @since 6.0.025
|
||||
* @public static
|
||||
*/
|
||||
public static function getFontFullPath($file, $fontdir=false) {
|
||||
$fontfile = '';
|
||||
// search files on various directories
|
||||
if (($fontdir !== false) AND @file_exists($fontdir.$file)) {
|
||||
$fontfile = $fontdir.$file;
|
||||
} elseif (@file_exists(self::_getfontpath().$file)) {
|
||||
$fontfile = self::_getfontpath().$file;
|
||||
} elseif (@file_exists($file)) {
|
||||
$fontfile = $file;
|
||||
}
|
||||
return $fontfile;
|
||||
}
|
||||
|
||||
/**
|
||||
* Converts UTF-8 characters array to array of Latin1 characters array<br>
|
||||
* @param $unicode (array) array containing UTF-8 unicode values
|
||||
|
@ -2535,55 +2642,6 @@ class TCPDF_FONTS {
|
|||
return $ordarray;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get a reference font size.
|
||||
* @param $size (string) String containing font size value.
|
||||
* @param $refsize (float) Reference font size in points.
|
||||
* @return float value in points
|
||||
* @public static
|
||||
*/
|
||||
public static function getFontRefSize($size, $refsize=12) {
|
||||
switch ($size) {
|
||||
case 'xx-small': {
|
||||
$size = ($refsize - 4);
|
||||
break;
|
||||
}
|
||||
case 'x-small': {
|
||||
$size = ($refsize - 3);
|
||||
break;
|
||||
}
|
||||
case 'small': {
|
||||
$size = ($refsize - 2);
|
||||
break;
|
||||
}
|
||||
case 'medium': {
|
||||
$size = $refsize;
|
||||
break;
|
||||
}
|
||||
case 'large': {
|
||||
$size = ($refsize + 2);
|
||||
break;
|
||||
}
|
||||
case 'x-large': {
|
||||
$size = ($refsize + 4);
|
||||
break;
|
||||
}
|
||||
case 'xx-large': {
|
||||
$size = ($refsize + 6);
|
||||
break;
|
||||
}
|
||||
case 'smaller': {
|
||||
$size = ($refsize - 3);
|
||||
break;
|
||||
}
|
||||
case 'larger': {
|
||||
$size = ($refsize + 3);
|
||||
break;
|
||||
}
|
||||
}
|
||||
return $size;
|
||||
}
|
||||
|
||||
} // END OF TCPDF_FONTS CLASS
|
||||
|
||||
//============================================================+
|
||||
|
|
|
@ -160,6 +160,14 @@ class TCPDF_IMAGES {
|
|||
* @public static
|
||||
*/
|
||||
public static function _parsejpeg($file) {
|
||||
// check if is a local file
|
||||
if (!@file_exists($file)) {
|
||||
// try to encode spaces on filename
|
||||
$tfile = str_replace(' ', '%20', $file);
|
||||
if (@file_exists($tfile)) {
|
||||
$file = $tfile;
|
||||
}
|
||||
}
|
||||
$a = getimagesize($file);
|
||||
if (empty($a)) {
|
||||
//Missing or incorrect image file
|
||||
|
@ -289,8 +297,8 @@ class TCPDF_IMAGES {
|
|||
$trns = '';
|
||||
$data = '';
|
||||
$icc = false;
|
||||
$n = TCPDF_STATIC::_freadint($f);
|
||||
do {
|
||||
$n = TCPDF_STATIC::_freadint($f);
|
||||
$type = fread($f, 4);
|
||||
if ($type == 'PLTE') {
|
||||
// read palette
|
||||
|
@ -338,6 +346,7 @@ class TCPDF_IMAGES {
|
|||
} else {
|
||||
TCPDF_STATIC::rfread($f, $n + 4);
|
||||
}
|
||||
$n = TCPDF_STATIC::_freadint($f);
|
||||
} while ($n);
|
||||
if (($colspace == 'Indexed') AND (empty($pal))) {
|
||||
// Missing palette
|
||||
|
|
File diff suppressed because it is too large
Load diff
Reference in a new issue