1
1
<?php
2
2
//============================================================+
3
3
// File name : tcpdf.php
4
- // Version : 6.0.078
4
+ // Version : 6.0.079
5
5
// Begin : 2002-08-03
6
- // Last Update : 2014-05-06
6
+ // Last Update : 2014-05-19
7
7
// Author : Nicola Asuni - Tecnick.com LTD - www.tecnick.com -
[email protected]
8
8
// License : GNU-LGPL v3 (http://www.gnu.org/copyleft/lesser.html)
9
9
// -------------------------------------------------------------------
104
104
* Tools to encode your unicode fonts are on fonts/utils directory.</p>
105
105
* @package com.tecnick.tcpdf
106
106
* @author Nicola Asuni
107
- * @version 6.0.078
107
+ * @version 6.0.079
108
108
*/
109
109
110
110
// TCPDF configuration
128
128
* 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>
129
129
* @package com.tecnick.tcpdf
130
130
* @brief PHP class for generating PDF documents without requiring external extensions.
131
- * @version 6.0.078
131
+ * @version 6.0.079
132
132
* @author Nicola Asuni -
[email protected]
133
133
*/
134
134
class TCPDF {
@@ -6861,6 +6861,9 @@ public function Image($file, $x='', $y='', $w=0, $h=0, $type='', $link='', $alig
6861
6861
$original_file = $file;
6862
6862
$file = TCPDF_STATIC::getObjFilename('img');
6863
6863
$fp = fopen($file, 'w');
6864
+ if (!$fp) {
6865
+ $this->Error('Unable to write file: '.$file);
6866
+ }
6864
6867
fwrite($fp, $imgdata);
6865
6868
fclose($fp);
6866
6869
unset($imgdata);
@@ -9713,17 +9716,13 @@ protected function _putcatalog() {
9713
9716
//$out .= ' /PieceInfo <<>>';
9714
9717
if (!empty($this->pdflayers)) {
9715
9718
$lyrobjs = '';
9716
- $lyrobjs_print = '';
9717
- $lyrobjs_view = '';
9719
+ $lyrobjs_off = '';
9718
9720
$lyrobjs_lock = '';
9719
9721
foreach ($this->pdflayers as $layer) {
9720
9722
$layer_obj_ref = ' '.$layer['objid'].' 0 R';
9721
9723
$lyrobjs .= $layer_obj_ref;
9722
- if ($layer['print']) {
9723
- $lyrobjs_print .= $layer_obj_ref;
9724
- }
9725
- if ($layer['view']) {
9726
- $lyrobjs_view .= $layer_obj_ref;
9724
+ if ($layer['view'] === false) {
9725
+ $lyrobjs_off .= $layer_obj_ref;
9727
9726
}
9728
9727
if ($layer['lock']) {
9729
9728
$lyrobjs_lock .= $layer_obj_ref;
@@ -9734,8 +9733,7 @@ protected function _putcatalog() {
9734
9733
$out .= ' /Name '.$this->_textstring('Layers', $oid);
9735
9734
$out .= ' /Creator '.$this->_textstring('TCPDF', $oid);
9736
9735
$out .= ' /BaseState /ON';
9737
- $out .= ' /ON ['.$lyrobjs_print.']';
9738
- $out .= ' /OFF ['.$lyrobjs_view.']';
9736
+ $out .= ' /OFF ['.$lyrobjs_off.']';
9739
9737
$out .= ' /Locked ['.$lyrobjs_lock.']';
9740
9738
$out .= ' /Intent /View';
9741
9739
$out .= ' /AS [';
@@ -21995,7 +21993,7 @@ protected function hyphenateWord($word, $patterns, $dictionary=array(), $leftmin
21995
21993
if (isset($dictionary[$word_string])) {
21996
21994
return TCPDF_FONTS::UTF8StringToArray($dictionary[$word_string], $this->isunicode, $this->CurrentFont);
21997
21995
}
21998
- // suround word with '_' characters
21996
+ // surround word with '_' characters
21999
21997
$tmpword = array_merge(array(95), $word, array(95));
22000
21998
$tmpnumchars = $numchars + 2;
22001
21999
$maxpos = $tmpnumchars - $charmin;
@@ -22055,14 +22053,15 @@ public function hyphenateText($text, $patterns, $dictionary=array(), $leftmin=1,
22055
22053
$word = array(); // last word
22056
22054
$txtarr = array(); // text to be returned
22057
22055
$intag = false; // true if we are inside an HTML tag
22056
+ $skip = false; // true to skip hyphenation
22058
22057
if (!is_array($patterns)) {
22059
22058
$patterns = TCPDF_STATIC::getHyphenPatternsFromTEX($patterns);
22060
22059
}
22061
22060
// get array of characters
22062
22061
$unichars = TCPDF_FONTS::UTF8StringToArray($text, $this->isunicode, $this->CurrentFont);
22063
22062
// for each char
22064
22063
foreach ($unichars as $char) {
22065
- if ((!$intag) AND TCPDF_FONT_DATA::$uni_type[$char] == 'L') {
22064
+ if ((!$intag) AND (!$skip) AND TCPDF_FONT_DATA::$uni_type[$char] == 'L') {
22066
22065
// letter character
22067
22066
$word[] = $char;
22068
22067
} else {
@@ -22079,6 +22078,16 @@ public function hyphenateText($text, $patterns, $dictionary=array(), $leftmin=1,
22079
22078
} elseif ($intag AND (chr($char) == '>')) {
22080
22079
// end of HTML tag
22081
22080
$intag = false;
22081
+ // check for style tag
22082
+ if (empty(array_diff(array_slice($txtarr, -6, 5), array(115, 116, 121, 108, 101)))) { // = 'style'
22083
+ if (empty(array_diff(array_slice($txtarr, -7, 1), array(47)))) { // '/' = 47
22084
+ // closing style tag
22085
+ $skip = false;
22086
+ } else {
22087
+ // opening style tag
22088
+ $skip = true;
22089
+ }
22090
+ }
22082
22091
}
22083
22092
}
22084
22093
}
0 commit comments