Skip to content

imagettftext() does not properly render combining chars #17352

Open
@cmb69

Description

@cmb69

Description

I'm forwarding this from the ancient https://bugs.php.net/34670; I had reported that a couple of years ago upstream (libgd/libgd#758), where the ticket had been closed as WONTFIX; however, that was a week after libgd 2.3.3 had been released, which has optional support for libraqm, which solves the issue, as I found out while investigating on libgd/libgd#861.

The following code:

<?php
$im = imagecreatetruecolor(64, 32);
imagefilledrectangle($im, 0, 0, imagesx($im) - 1, imagesy($im) - 1, 0x000000);
imagettftext($im, 16, 0, 10, 20, 0xffffff, "Arial", hex2bin("c3a461cc88"));
imagegif($im, __DIR__ . "/out.gif");

Resulted in this output (bundled libgd):
gd861

But I expected this output instead (libgd 2.3.3 with libraqm):
gd861

So to solve this for our bundled libgd, we would need to add support for libraqm (probably that wouldn't be a big deal, if especially gdft.c hadn't been diverged between bundled and external libgd, and I believe there are a couple of important fixes only in bundled libgd). For Windows users, we would also need to build and ship libraqm and its dependencies (at least harfbuzz in this case).

PHP Version

any

Operating System

any

Metadata

Metadata

Assignees

No one assigned

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions