bug fixes

This commit is contained in:
Dennis Eichhorn 2023-08-02 09:34:42 +00:00
parent cdd0f7157b
commit 4c0e0ca179
2 changed files with 13 additions and 13 deletions

View File

@ -54,7 +54,7 @@ class TCPDF_IMAGES {
* Array of hinheritable SVG properties.
* @since 5.0.000 (2010-05-02)
* @public static
*
*
* @var string[]
*/
public static $svginheritprop = ['clip-rule', 'color', 'color-interpolation', 'color-interpolation-filters', 'color-profile', 'color-rendering', 'cursor', 'direction', 'display', 'fill', 'fill-opacity', 'fill-rule', 'font', 'font-family', 'font-size', 'font-size-adjust', 'font-stretch', 'font-style', 'font-variant', 'font-weight', 'glyph-orientation-horizontal', 'glyph-orientation-vertical', 'image-rendering', 'kerning', 'letter-spacing', 'marker', 'marker-end', 'marker-mid', 'marker-start', 'pointer-events', 'shape-rendering', 'stroke', 'stroke-dasharray', 'stroke-dashoffset', 'stroke-linecap', 'stroke-linejoin', 'stroke-miterlimit', 'stroke-opacity', 'stroke-width', 'text-anchor', 'text-rendering', 'visibility', 'word-spacing', 'writing-mode'];
@ -88,9 +88,9 @@ class TCPDF_IMAGES {
/**
* Set the transparency for the given GD image.
* @param resource $new_image GD image object
* @param resource $image GD image object
* @return resource GD image object $new_image
* @param \GdImage $new_image GD image object
* @param \GdImage $image GD image object
* @return \GdImage GD image object $new_image
* @since 4.9.016 (2010-04-20)
* @public static
*/
@ -113,7 +113,7 @@ class TCPDF_IMAGES {
/**
* Convert the loaded image to a PNG and then return a structure for the PDF creator.
* This function requires GD library and write access to the directory defined on K_PATH_CACHE constant.
* @param resource $image image object
* @param \GdImage $image image object
* @param string $tempfile Temporary file name.
* return image PNG image object.
* @since 4.9.016 (2010-04-20)
@ -121,7 +121,7 @@ class TCPDF_IMAGES {
*/
public static function _toPNG($image, $tempfile) {
// turn off interlaced mode
\imageinterlace($image, 0);
\imageinterlace($image, null);
// create temporary PNG image
\imagepng($image, $tempfile);
// remove image from memory
@ -136,7 +136,7 @@ class TCPDF_IMAGES {
/**
* Convert the loaded image to a JPEG and then return a structure for the PDF creator.
* This function requires GD library and write access to the directory defined on K_PATH_CACHE constant.
* @param resource $image image object
* @param \GdImage $image image object
* @param int $quality JPEG quality
* @param string $tempfile Temporary file name.
* return array|false image JPEG image object.

View File

@ -7044,8 +7044,8 @@ class TCPDF {
// fit the image on available space
list($w, $h, $x, $y) = $this->fitBlock($w, $h, $x, $y, $fitonpage);
// calculate new minimum dimensions in pixels
$neww = \round($w * $this->k * $dpi / $this->dpi);
$newh = \round($h * $this->k * $dpi / $this->dpi);
$neww = (int) \round($w * $this->k * $dpi / $this->dpi);
$newh = (int) \round($h * $this->k * $dpi / $this->dpi);
// check if resize is necessary (resize is used only to reduce the image)
$newsize = ($neww * $newh);
$pixsize = ($pixw * $pixh);
@ -7957,11 +7957,11 @@ class TCPDF {
$ratio = \preg_replace('/[^0-9\.]/', '', $ratio);
$ratio = (float) $ratio;
if ($type == 'u') {
$chrdiff = \floor(($diff + 12) * $ratio);
$chrdiff = (int) \floor(($diff + 12) * $ratio);
$shift = \str_repeat(' ', $chrdiff);
$shift = TCPDF_FONTS::UTF8ToUTF16BE($shift, false, $this->isunicode, $this->CurrentFont);
} else {
$chrdiff = \floor(($diff + 11) * $ratio);
$chrdiff = (int) \floor(($diff + 11) * $ratio);
$shift = \str_repeat(' ', $chrdiff);
}
$page = \str_replace($aa, $shift, $page);
@ -15655,7 +15655,7 @@ class TCPDF {
$gvars = $this->getGraphicVars();
// create new barcode object
$barcodeobj = new TCPDF2DBarcode($code, $type);
$arrcode = $barcodeobj->getBarcodeArrayArray();
$arrcode = $barcodeobj->getBarcodeArray();
if (empty($arrcode) || !isset($arrcode['num_rows']) || ($arrcode['num_rows'] == 0) || !isset($arrcode['num_cols']) || ($arrcode['num_cols'] == 0)) {
$this->Error('Error in 2D barcode string');
}
@ -18035,7 +18035,7 @@ Putting 1 is equivalent to putting 0 and calling Ln() just after. Default value:
$newpmid = '[('.\str_replace(\chr(0).\chr(32), ') '.\sprintf('%F', $spacew).' (', $replace).')]';
$pos = \strpos($pmid, $pmatch, $pos);
if ($pos !== false) {
$pmid = sub\str_replace($pmid, $newpmid, $pos, \strlen($pmatch));
$pmid = \substr_replace($pmid, $newpmid, $pos, \strlen($pmatch));
}
++$pos;
}