Package: php8.1-gd
Version: 8.1.0-1
Followup-For: Bug #980759
X-Debbugs-Cc: t...@mirbsd.de
Control: retitle -1 php8.1: imageftbbox returns too small bounding box

(pbuild3309-sid/i386)root@tglase:/tmp# php x.php
Array
(   
    [V] => 8.1.0
    [bbox] => Array
        (   
            [0] => 1
            [1] => 0
            [2] => 185
            [3] => 0
            [4] => 185
            [5] => -11
            [6] => 1
            [7] => -11
        )

    [ascender] => 11
    [descender] => 0
    [size_w] => 186
    [size_h] => 11
    [x] => -1
    [y] => 11
)

Still same as 8.0 and 7.4(bullseye):

$ php x.php
Array
(   
    [V] => 7.4.25
    [bbox] => Array
        (   
            [0] => 1
            [1] => 0
            [2] => 185
            [3] => 0
            [4] => 185
            [5] => -11
            [6] => 1
            [7] => -11
        )

    [ascender] => 11
    [descender] => 0
    [size_w] => 186
    [size_h] => 11
    [x] => -1
    [y] => 11
)

For comparison, in buster the values are as expected:

$ php x.php
Array
(   
    [V] => 7.3.31-1~deb10u1
    [bbox] => Array
        (   
            [0] => 0
            [1] => 1
            [2] => 187
            [3] => 1
            [4] => 187
            [5] => -13
            [6] => 0
            [7] => -13
        )

    [ascender] => 13
    [descender] => 1
    [size_w] => 187
    [size_h] => 14
    [x] => 0
    [y] => 13
)



-- Package-specific info:
==== Additional PHP 8.1 information ====

++++ PHP @PHP_VERSION SAPI (php8.1query -S): ++++

++++ PHP 8.1 Extensions (php8.1query -M -v): ++++

++++ Configuration files: ++++
**** /etc/php/8.1/mods-available/gd.ini ****
extension=gd.so


-- System Information:
Debian Release: bookworm/sid
  APT prefers buildd-unstable
  APT policy: (500, 'buildd-unstable'), (500, 'unstable'), (1, 'experimental')
Architecture: i386 (i686)

Kernel: Linux 5.10.0-9-amd64 (SMP w/4 CPU threads)
Kernel taint flags: TAINT_FIRMWARE_WORKAROUND
Locale: LANG=C, LC_CTYPE=C (charmap=ANSI_X3.4-1968) (ignored: LC_ALL set to C), 
LANGUAGE not set
Shell: /bin/sh linked to /bin/dash
Init: sysvinit (via /sbin/init)

Versions of packages php8.1-gd depends on:
ii  libc6          2.32-4
ii  libgd3         2.3.0-2
ii  php-common     2:88
ii  php8.1-common  8.1.0-1
ii  ucf            3.0043

php8.1-gd recommends no packages.

php8.1-gd suggests no packages.

Versions of packages php8.1-common depends on:
ii  libc6       2.32-4
ii  libffi8     3.4.2-3
ii  libssl1.1   1.1.1l-1
ii  php-common  2:88
ii  ucf         3.0043

Versions of packages php8.1-cli depends on:
ii  libargon2-1      0~20171227-0.2
ii  libc6            2.32-4
ii  libedit2         3.1-20210910-1
ii  libmagic1        1:5.41-2
ii  libpcre2-8-0     10.39-3
ii  libsodium23      1.0.18-1
ii  libssl1.1        1.1.1l-1
ii  libxml2          2.9.12+dfsg-5+b1
ii  mime-support     3.66
ii  php8.1-common    8.1.0-1
ii  php8.1-opcache   8.1.0-1
ii  php8.1-readline  8.1.0-1
ii  tzdata           2021e-1
ii  ucf              3.0043
ii  zlib1g           1:1.2.11.dfsg-2

Versions of packages php8.1-cli suggests:
pn  php-pear  <none>

-- no debconf information
<?php
        $text = "2020-12-23T13:25:44Z";
        $font = getcwd()."/Inconsolatazi4varl_qu-Regular.otf";    // attached
        $fontsize = 14;
        $bbox = imageftbbox($fontsize, 0, $font, $text);
        $ascender = abs($bbox[7]) /* +1 */;
        $descender = abs($bbox[1]);
        $size_w = abs($bbox[0]) + abs($bbox[2]);
        $size_h = $ascender + $descender;
        $x = -$bbox[0];
        $y = $ascender;
print_r(array("V"=>phpversion(),"bbox"=>$bbox,"ascender"=>$ascender,"descender"=>$descender,"size_w"=>$size_w,"size_h"=>$size_h,"x"=>$x,"y"=>$y));
        $im = imagecreatetruecolor($size_w, $size_h);
        $bgcol = imagecolorallocate($im, 0xDD, 0xDD, 0xDD);
        $fgcol = imagecolorallocate($im, 0x00, 0x00, 0x23);
        imagefilledrectangle($im, 0, 0, $size_w - 1, $size_h - 1, $bgcol);
        imagefttext($im, $fontsize, 0, $x, $y, $fgcol, $font, $text);
        imagetruecolortopalette($im, FALSE, 256);
//        imagepng($im, NULL, 9);

Reply via email to