bug51263.phpt 752 B

123456789101112131415161718192021222324252627282930313233
  1. --TEST--
  2. Bug #51263 (imagettftext and rotated text uses wrong baseline)
  3. --EXTENSIONS--
  4. gd
  5. --SKIPIF--
  6. <?php
  7. if(!function_exists('imagettftext')) die('skip imagettftext() not available');
  8. ?>
  9. --FILE--
  10. <?php
  11. $cwd = __DIR__;
  12. $ttf = "$cwd/Tuffy.ttf";
  13. $w = 23;
  14. $h = 70;
  15. $img = imagecreatetruecolor($w, $h);
  16. $blk = imagecolorallocate($img, 0, 0, 0);
  17. imagefilledrectangle($img, 0, 0, $w-1, $h-1, $blk);
  18. $col = imagecolorallocate($img, 255, 255, 255);
  19. imagettftext($img, 8, 90, 10, 60, $col, $ttf, "foo bar qux");
  20. $x = array(0, 1, 2, 3, 13);
  21. for ($j=0; $j<30; $j++) {
  22. foreach ($x as $i) {
  23. $c = imagecolorat($img, $i, $j);
  24. if ($c != 0) {
  25. echo "KO: ($i, $j)\n";
  26. exit;
  27. }
  28. }
  29. }
  30. echo "OK\n";
  31. ?>
  32. --EXPECT--
  33. OK