[php-src] Issue #15815: gd imagettftext characters overlap when text isn't horizontal, when vertical all characters are on top of each other.

From: Date: Mon, 09 Sep 2024 19:06:33 +0000
Subject: [php-src] Issue #15815: gd imagettftext characters overlap when text isn't horizontal, when vertical all characters are on top of each other.
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-247734@lists.php.net to get a copy of this message
Issue: https://github.com/php/php-src/issues/15815 Author: ghpille ### Description The following code: ``` <?php $gdfont = '/usr/share/fonts/truetype/dejavu/DejaVuSansMono.ttf'; $image = imageCreate(640,480); $colorRed = imageColorAllocate($image, 255,0,0); $colorYellow = imageColorAllocate($image, 255,255,0); imageFilledRectangle($image, 50, 50, 590, 430, $colorYellow); // Create a color $colorYellow = imageColorAllocate($image, 255,255,0); $colorBlack = imagecolorallocate($image, 0, 0, 0); // add text $i = 100; $c = 0; $x2 = 0; $y2 = 100; for ($a=0; $a<=360; $a+=15) { $colorX = imagecolorallocate($image,$c,$c,$c); $b = imagettftext($image,12,$a,$i+$x2,$i+$y2,$colorX,$gdfont, "Hello, Worldy! $a/$c"); imagepolygon($image,$b,$colorX); if ($c > 0) { if (($a % 90) == 0) { switch ($a / 90) { case 1: $x2 = 250; $y2 = 0; break; case 2: $x2 = 0; $y2 = 300; break; case 3: $x2 = 250; $y2 = 200; break; } } } $c += 8; } // Set type of image and send the output header("Content-type: image/jpeg"); imageJpeg($image); imageDestroy($image); // Release memory imageDestroy($image); ?> ``` Resulted in this output: ![gd](https://github.com/user-attachments/assets/4d51616d-9442-4933-bbb3-aa653459e82e) But I expected this output instead: Where even a vertical text is legible. ### PHP Version PHP 8.2.20 ### Operating System Devuan Excalibur (≃Debian testing)

« previous php.bugs (#247734) next »