Skip to content

Commit

Permalink
Merge pull request #135 from diegomarty/master
Browse files Browse the repository at this point in the history
Deprecation notices float to int loses precision in PHP 8.1
  • Loading branch information
ffflabs committed May 17, 2022
2 parents 25ec86d + 043d650 commit 0c5053e
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion src/image/Image.php
Original file line number Diff line number Diff line change
Expand Up @@ -1037,6 +1037,10 @@ public function _StrokeTTF($x, $y, $txt, $dir, $paragraph_align, &$aBoundingBox,
// Do nothing the text is drawn at baseline by default
}
}

$x = (int) round($x);
$y = (int) round($y);

imagettftext(
$this->img,
$this->font_size,
Expand Down Expand Up @@ -1147,12 +1151,16 @@ public function _StrokeTTF($x, $y, $txt, $dir, $paragraph_align, &$aBoundingBox,
$xl -= $bbox[0] / 2;
$yl = $y - $yadj;
//$xl = $xl- $xadj;

$xl = (int) round($xl);
$yl = (int) round($yl - ($h - $fh) + $fh * $i);

imagettftext(
$this->img,
$this->font_size,
$dir,
$xl,
$yl - ($h - $fh) + $fh * $i,
$yl,
$this->current_color,
$this->font_file,
$tmp[$i]
Expand Down

0 comments on commit 0c5053e

Please sign in to comment.