|
| 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 | +?> |
| 7 | +--FILE-- |
| 8 | +<?php |
| 9 | +$cwd = dirname(__FILE__); |
| 10 | +$font = "$cwd/test8859.ttf"; |
| 11 | +$delta_t = 360.0 / 16; # Make 16 steps around |
| 12 | +$g = imagecreate(800, 800); |
| 13 | +$bgnd = imagecolorallocate($g, 255, 255, 255); |
| 14 | +$black = imagecolorallocate($g, 0, 0, 0); |
| 15 | +$x = 100; |
| 16 | +$y = 0; |
| 17 | +$cos_t = cos(deg2rad($delta_t)); |
| 18 | +$sin_t = sin(deg2rad($delta_t)); |
| 19 | +for ($angle = 0.0; $angle < 360.0; $angle += $delta_t) { |
| 20 | + $bbox = imagettftext($g, 24, $angle, 400+$x, 400+$y, $black, $font, 'ABCDEF'); |
| 21 | + $s = vsprintf("(%d, %d), (%d, %d), (%d, %d), (%d, %d)\n", $bbox); |
| 22 | + echo $s; |
| 23 | + $temp = $cos_t * $x + $sin_t * $y; |
| 24 | + $y = $cos_t * $y - $sin_t * $x; |
| 25 | + $x = $temp; |
| 26 | +} |
| 27 | +?> |
| 28 | +--EXPECTF-- |
| 29 | +(500, 400), (579, 400), (579, 370), (500, 370) |
| 30 | +(492, 361), (575, 327), (564, 301), (480, 335) |
| 31 | +(470, 329), (540, 260), (521, 242), (451, 312) |
| 32 | +(438, 307), (478, 210), (461, 204), (420, 301) |
| 33 | +(400, 300), (400, 193), (383, 193), (383, 300) |
| 34 | +(361, 307), (319, 207), (297, 216), (338, 317) |
| 35 | +(329, 329), (254, 254), (233, 275), (307, 351) |
| 36 | +(307, 361), (215, 323), (203, 354), (294, 392) |
| 37 | +(300, 400), (203, 400), (203, 431), (300, 431) |
| 38 | +(307, 438), (219, 474), (229, 501), (318, 465) |
| 39 | +(329, 470), (263, 535), (281, 553), (347, 489) |
| 40 | +(361, 492), (326, 575), (343, 582), (378, 499) |
| 41 | +(400, 500), (400, 584), (416, 584), (416, 500) |
| 42 | +(438, 492), (468, 567), (490, 559), (460, 483) |
| 43 | +(470, 470), (523, 525), (545, 505), (491, 449) |
| 44 | +(492, 438), (560, 467), (572, 436), (504, 408) |
0 commit comments