Hello,

I have a difference in behavior between PHP 8.1 RC6 and my system PHP for the 
function imagettfbbox.
It is hard to know if this is a problem with 8.1 really because I had to 
download and build imagick through pecl to be able to run this.

<?php
$font = '/usr/share/fonts/truetype/noto/NotoSans-Regular.ttf';
var_dump(imagettfbbox(12, 0, $font, 'E'));

The result for running this is:
$ ~/dev/php-src-git/sapi/cli/php ~/dev/test-freetype.php
array(8) {
  [0]=>
  int(1)
  [1]=>
  int(0)
  [2]=>
  int(8)
  [3]=>
  int(0)
  [4]=>
  int(8)
  [5]=>
  int(-12)
  [6]=>
  int(1)
  [7]=>
  int(-12)
}
$ php ~/dev/test-freetype.php
array(8) {
  [0]=>
  int(0)
  [1]=>
  int(1)
  [2]=>
  int(10)
  [3]=>
  int(1)
  [4]=>
  int(10)
  [5]=>
  int(-12)
  [6]=>
  int(0)
  [7]=>
  int(-12)
}

As you can see the resulting bounding box is not the same, for the same font. 
This messes up our avatar generation, which ends up a few pixels wrong on the 
centering of the initial in the image.

Does anyone knows where this can come from, and if by changing how I build/link 
imagick I can get the same result on both binaries?

Côme

--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: https://www.php.net/unsub.php

Reply via email to