mirror of
https://github.com/php/php-src.git
synced 2026-03-24 00:02:20 +01:00
We apply the same fix that has been applied to external libgd at least as of 2.0.29. To avoid issues regarding minor FreeType rendering differences, the test case does not compare against an image, but rather checks that all pixels outside the clipping rect have the background color. Closes GH-17374.
27 lines
614 B
PHP
27 lines
614 B
PHP
--TEST--
|
|
Bug GH-17373 (imagefttext() ignores clipping rect for palette images)
|
|
--EXTENSIONS--
|
|
gd
|
|
--FILE--
|
|
<?php
|
|
$im = imagecreate(64, 32);
|
|
$bg = imagecolorallocate($im, 0, 0, 0);
|
|
$fg = imagecolorallocate($im, 255, 255, 255);
|
|
imagefilledrectangle($im, 0, 0, 63, 31, $bg);
|
|
imagesetclip($im, 32, 0, 63, 31);
|
|
imagefttext($im, 16, 0, 10, 23, $fg, __DIR__ . "/Tuffy.ttf", "hello");
|
|
|
|
imagesetclip($im, 0, 0, 63, 31);
|
|
$count = 0;
|
|
for ($j = 0; $j < 31; $j++) {
|
|
for ($i = 0; $i < 31; $i++) {
|
|
if (imagecolorat($im, $i, $j) !== $bg) {
|
|
$count++;
|
|
}
|
|
}
|
|
}
|
|
var_dump($count);
|
|
?>
|
|
--EXPECT--
|
|
int(0)
|