Skip to content

Commit bc27ce9

Browse files
committed
Merge branch 'PHP-5.6' into PHP-7.0
2 parents cfc8522 + 09eb6ed commit bc27ce9

File tree

4 files changed

+33
-0
lines changed

4 files changed

+33
-0
lines changed

NEWS

+2
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,8 @@ PHP NEWS
2020
- GD:
2121
. Fixed bug #67325 (imagetruecolortopalette: white is duplicated in palette).
2222
(cmb)
23+
. Fixed bug #50194 (imagettftext broken on transparent background w/o
24+
alphablending). (cmb)
2325

2426
- Mbstring:
2527
. Fixed bug #66797 (mb_substr only takes 32-bit signed integer). (cmb)

ext/gd/libgd/gdft.c

+2
Original file line numberDiff line numberDiff line change
@@ -658,6 +658,8 @@ static char * gdft_draw_bitmap (gdCache_head_t *tc_cache, gdImage * im, int fg,
658658
} else {
659659
return "Unsupported ft_pixel_mode";
660660
}
661+
if (level == 0) /* if background */
662+
continue;
661663
if ((fg >= 0) && (im->trueColor)) {
662664
/* Consider alpha in the foreground color itself to be an
663665
* upper bound on how opaque things get, when truecolor is

ext/gd/tests/bug50194.phpt

+29
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
--TEST--
2+
Bug #50194 (imagettftext broken on transparent background w/o alphablending)
3+
--SKIPIF--
4+
<?php
5+
if (!extension_loaded('gd')) die('skip gd extension not available');
6+
if (!function_exists('imagettftext')) die('skip imagettftext() not available');
7+
?>
8+
--FILE--
9+
<?php
10+
require_once __DIR__ . DIRECTORY_SEPARATOR . 'func.inc';
11+
12+
$im = imagecreatetruecolor(240, 55);
13+
$background = imagecolorallocatealpha($im, 60, 60, 60, 0); // no tranparency
14+
$black = imagecolorallocate($im, 0, 0, 0);
15+
imagealphablending($im, false);
16+
imagefilledrectangle($im, 0, 0, 239, 54, $background);
17+
$text = 'Testing ... ';
18+
$font = __DIR__ . DIRECTORY_SEPARATOR . 'Tuffy.ttf';
19+
imagettftext($im, 40, 0, 10, 40, $black, $font, $text);
20+
imagesavealpha($im, true);
21+
22+
test_image_equals_file(__DIR__ . DIRECTORY_SEPARATOR . 'bug50194.png', $im);
23+
24+
imagedestroy($im);
25+
?>
26+
===DONE===
27+
--EXPECT--
28+
The images are equal.
29+
===DONE===

ext/gd/tests/bug50194.png

2.76 KB
Loading

0 commit comments

Comments
 (0)