Annotation of embedaddon/php/ext/gd/tests/bug43073.phpt, revision 1.1
1.1 ! misho 1: --TEST--
! 2: Bug #43073 (TrueType bounding box is wrong for angle<>0)
! 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: $cwd = dirname(__FILE__);
! 11: $font = "$cwd/Tuffy.ttf";
! 12: $delta_t = 360.0 / 16; # Make 16 steps around
! 13: $g = imagecreate(800, 800);
! 14: $bgnd = imagecolorallocate($g, 255, 255, 255);
! 15: $black = imagecolorallocate($g, 0, 0, 0);
! 16: $x = 100;
! 17: $y = 0;
! 18: $cos_t = cos(deg2rad($delta_t));
! 19: $sin_t = sin(deg2rad($delta_t));
! 20: for ($angle = 0.0; $angle < 360.0; $angle += $delta_t) {
! 21: $bbox = imagettftext($g, 24, $angle, 400+$x, 400+$y, $black, $font, 'ABCDEF');
! 22: $s = vsprintf("(%d, %d), (%d, %d), (%d, %d), (%d, %d)\n", $bbox);
! 23: echo $s;
! 24: $temp = $cos_t * $x + $sin_t * $y;
! 25: $y = $cos_t * $y - $sin_t * $x;
! 26: $x = $temp;
! 27: }
! 28: imagepng($g, "$cwd/bug43073.png");
! 29: ?>
! 30: --CLEAN--
! 31: <?php @unlink(dirname(__FILE__) . '/bug43073.png'); ?>
! 32: --EXPECTF--
! 33: (500, 402), (610, 402), (610, 376), (500, 376)
! 34: (492, 363), (591, 322), (580, 295), (480, 336)
! 35: (470, 331), (548, 254), (527, 233), (449, 310)
! 36: (439, 309), (483, 202), (461, 193), (416, 299)
! 37: (401, 300), (401, 183), (381, 183), (381, 300)
! 38: (362, 307), (316, 195), (291, 205), (337, 318)
! 39: (330, 329), (246, 244), (224, 265), (308, 350)
! 40: (308, 360), (202, 316), (190, 344), (296, 388)
! 41: (300, 399), (186, 399), (186, 425), (300, 425)
! 42: (306, 437), (195, 483), (206, 510), (318, 464)
! 43: (328, 469), (240, 557), (260, 578), (349, 491)
! 44: (359, 491), (312, 607), (334, 616), (382, 501)
! 45: (398, 500), (398, 618), (418, 618), (418, 500)
! 46: (436, 493), (483, 607), (507, 597), (461, 482)
! 47: (468, 471), (555, 558), (577, 538), (490, 450)
! 48: (490, 440), (600, 485), (611, 457), (502, 412)
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>