forked from moodle/moodle
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'MDL-79665' of https://github.com/paulholden/moodle
- Loading branch information
Showing
10 changed files
with
79 additions
and
52 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,15 +6,14 @@ | |
|
||
* **category** Library | ||
* **author** Nicola Asuni <[email protected]> | ||
* **copyright** 2002-2022 Nicola Asuni - Tecnick.com LTD | ||
* **copyright** 2002-2023 Nicola Asuni - Tecnick.com LTD | ||
* **license** http://www.gnu.org/copyleft/lesser.html GNU-LGPL v3 (see LICENSE.TXT) | ||
* **link** http://www.tcpdf.org | ||
* **source** https://github.com/tecnickcom/TCPDF | ||
|
||
|
||
## IMPORTANT | ||
A new version of this library is under development at https://github.com/tecnickcom/tc-lib-pdf and as a consequence this version will not receive any additional development or support. | ||
This version should be considered obsolete, new projects should use the new version as soon it will become stable. | ||
## NOTE | ||
A new version of this library is under development at https://github.com/tecnickcom/tc-lib-pdf and as a consequence this library is in support only mode. | ||
|
||
|
||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,11 +3,11 @@ | |
// File name : tcpdf_static.php | ||
// Version : 1.1.4 | ||
// Begin : 2002-08-03 | ||
// Last Update : 2022-08-12 | ||
// Last Update : 2023-09-06 | ||
// Author : Nicola Asuni - Tecnick.com LTD - www.tecnick.com - [email protected] | ||
// License : GNU-LGPL v3 (http://www.gnu.org/copyleft/lesser.html) | ||
// ------------------------------------------------------------------- | ||
// Copyright (C) 2002-2022 Nicola Asuni - Tecnick.com LTD | ||
// Copyright (C) 2002-2023 Nicola Asuni - Tecnick.com LTD | ||
// | ||
// This file is part of TCPDF software library. | ||
// | ||
|
@@ -55,7 +55,7 @@ class TCPDF_STATIC { | |
* Current TCPDF version. | ||
* @private static | ||
*/ | ||
private static $tcpdf_version = '6.6.2'; | ||
private static $tcpdf_version = '6.6.5'; | ||
|
||
/** | ||
* String alias for total number of pages. | ||
|
@@ -1780,7 +1780,7 @@ public static function pregSplit($pattern, $modifiers, $subject, $limit=NULL, $f | |
if ($ret === false) { | ||
return array(); | ||
} | ||
return $ret; | ||
return is_array($ret) ? $ret : array(); | ||
} | ||
// preg_split is bugged - try alternative solution | ||
$ret = array(); | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,13 @@ | ||
<?php | ||
//============================================================+ | ||
// File name : tcpdf.php | ||
// Version : 6.6.2 | ||
// Version : 6.6.5 | ||
// Begin : 2002-08-03 | ||
// Last Update : 2022-12-06 | ||
// Last Update : 2023-09-06 | ||
// Author : Nicola Asuni - Tecnick.com LTD - www.tecnick.com - [email protected] | ||
// License : GNU-LGPL v3 (http://www.gnu.org/copyleft/lesser.html) | ||
// ------------------------------------------------------------------- | ||
// Copyright (C) 2002-2022 Nicola Asuni - Tecnick.com LTD | ||
// Copyright (C) 2002-2023 Nicola Asuni - Tecnick.com LTD | ||
// | ||
// This file is part of TCPDF software library. | ||
// | ||
|
@@ -104,7 +104,7 @@ | |
* Tools to encode your unicode fonts are on fonts/utils directory.</p> | ||
* @package com.tecnick.tcpdf | ||
* @author Nicola Asuni | ||
* @version 6.6.2 | ||
* @version 6.6.5 | ||
*/ | ||
|
||
// TCPDF configuration | ||
|
@@ -128,7 +128,7 @@ | |
* 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 6.6.2 | ||
* @version 6.6.5 | ||
* @author Nicola Asuni - [email protected] | ||
* @IgnoreAnnotation("protected") | ||
* @IgnoreAnnotation("public") | ||
|
@@ -574,12 +574,14 @@ class TCPDF { | |
/** | ||
* Minimum distance between header and top page margin. | ||
* @protected | ||
* @var float | ||
*/ | ||
protected $header_margin; | ||
|
||
/** | ||
* Minimum distance between footer and bottom page margin. | ||
* @protected | ||
* @var float | ||
*/ | ||
protected $footer_margin; | ||
|
||
|
@@ -2461,7 +2463,7 @@ public function setLastH($h) { | |
*/ | ||
public function getCellHeight($fontsize, $padding=TRUE) { | ||
$height = ($fontsize * $this->cell_height_ratio); | ||
if ($padding) { | ||
if ($padding && !empty($this->cell_padding)) { | ||
$height += ($this->cell_padding['T'] + $this->cell_padding['B']); | ||
} | ||
return round($height, 6); | ||
|
@@ -3372,7 +3374,7 @@ public function getHeaderData() { | |
/** | ||
* Set header margin. | ||
* (minimum distance between header and top page margin) | ||
* @param int $hm distance in user units | ||
* @param float $hm distance in user units | ||
* @public | ||
*/ | ||
public function setHeaderMargin($hm=10) { | ||
|
@@ -3392,7 +3394,7 @@ public function getHeaderMargin() { | |
/** | ||
* Set footer margin. | ||
* (minimum distance between footer and bottom page margin) | ||
* @param int $fm distance in user units | ||
* @param float $fm distance in user units | ||
* @public | ||
*/ | ||
public function setFooterMargin($fm=10) { | ||
|
@@ -4102,6 +4104,7 @@ public function setTextColor($col1=0, $col2=-1, $col3=-1, $col4=-1, $ret=false, | |
* @param float $fontsize Font size in points. The default value is the current size. | ||
* @param boolean $getarray if true returns an array of characters widths, if false returns the total length. | ||
* @return float[]|float total string length or array of characted widths | ||
* @phpstan-return ($getarray is true ? float[] : float) total string length or array of characted widths | ||
* @author Nicola Asuni | ||
* @public | ||
* @since 1.2 | ||
|
@@ -4118,6 +4121,7 @@ public function GetStringWidth($s, $fontname='', $fontstyle='', $fontsize=0, $ge | |
* @param float $fontsize Font size in points. The default value is the current size. | ||
* @param boolean $getarray if true returns an array of characters widths, if false returns the total length. | ||
* @return float[]|float total string length or array of characted widths | ||
* @phpstan-return ($getarray is true ? float[] : float) total string length or array of characted widths | ||
* @author Nicola Asuni | ||
* @public | ||
* @since 2.4.000 (2008-03-06) | ||
|
@@ -6409,7 +6413,7 @@ public function Write($h, $txt, $link='', $fill=false, $align='', $ln=false, $st | |
// calculate maximum width for a single character on string | ||
$chrw = $this->GetArrStringWidth($chars, '', '', 0, true); | ||
array_walk($chrw, array($this, 'getRawCharWidth')); | ||
$maxchwidth = max($chrw); | ||
$maxchwidth = ((is_array($chrw) || $chrw instanceof Countable) && count($chrw) > 0) ? max($chrw) : 0; | ||
// get array of chars | ||
$uchars = TCPDF_FONTS::UTF8ArrayToUniArray($chars, $this->isunicode); | ||
// get the number of characters | ||
|
@@ -6872,6 +6876,8 @@ protected function fitBlock($w, $h, $x, $y, $fitonpage=false) { | |
} | ||
// resize the block to be contained on the remaining available page or column space | ||
if ($fitonpage) { | ||
// fallback to avoid division by zero | ||
$h = $h == 0 ? 1 : $h; | ||
$ratio_wh = ($w / $h); | ||
if (($y + $h) > $this->PageBreakTrigger) { | ||
$h = $this->PageBreakTrigger - $y; | ||
|
@@ -9925,7 +9931,7 @@ protected function _putcatalog() { | |
} | ||
$out .= ' >> >>'; | ||
} | ||
$font = $this->getFontBuffer('helvetica'); | ||
$font = $this->getFontBuffer((($this->pdfa_mode) ? 'pdfa' : '') .'helvetica'); | ||
$out .= ' /DA (/F'.$font['i'].' 0 Tf 0 g)'; | ||
$out .= ' /Q '.(($this->rtl)?'2':'0'); | ||
//$out .= ' /XFA '; | ||
|
@@ -22055,7 +22061,7 @@ public function getNumberOfColumns() { | |
public function setTextRenderingMode($stroke=0, $fill=true, $clip=false) { | ||
// Ref.: PDF 32000-1:2008 - 9.3.6 Text Rendering Mode | ||
// convert text rendering parameters | ||
if ($stroke < 0) { | ||
if ($stroke < 0 || !is_numeric($stroke)) { | ||
$stroke = 0; | ||
} | ||
if ($fill === true) { | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters