Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
Franck ALARY committed May 25, 2023
2 parents 0eca64e + 2e6d772 commit 3438934
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/Image.php
Original file line number Diff line number Diff line change
Expand Up @@ -974,8 +974,9 @@ private function imagettftextWithSpacing($image, float $size, float $angle, floa
$bottom = 0;

for ($i = 0; $i < $length; ++$i) {
\imagettftext($image, $size, $angle, $letterPos['x'], $letterPos['y'], $color, $font, $text[$i]);
$bbox = \imagettfbbox($size, 0, $font, $text[$i]);
$char = \mb_substr($text, $i, 1);
\imagettftext($image, $size, $angle, $letterPos['x'], $letterPos['y'], $color, $font, $char);
$bbox = \imagettfbbox($size, 0, $font, $char);
$letterPos = Geometry2D::getDstXY($letterPos['x'], $letterPos['y'], $angle, $spacing + $bbox[2]);

$textWidth += $bbox[2];
Expand Down

0 comments on commit 3438934

Please sign in to comment.