imagettftext() does not properly render combining chars
Nobody has claimed this yet.
- Dominant language
- C
- Stars
- 40.4k
- Forks
- 8.1k
- Avg merge
- 2d 13h
- Merged PRs (30d)
- 96
Description
Description
I'm forwarding this from the ancient https://bugs.php.net/34670; I had reported that a couple of years ago upstream (https://github.com/libgd/libgd/issues/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 https://github.com/libgd/libgd/issues/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):
But I expected this output instead (libgd 2.3.3 with libraqm):
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
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the bundled gdft.c implementation and reproduce the provided PHP example using a combining character. Compare its output with libgd 2.3.3 configured with libraqm, then determine the integration and Windows dependency requirements. Done means imagettftext() renders combining characters correctly with the bundled libgd across the supported builds.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- c, php
- Domain
- computer-graphics
- Issue type
- Bug
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 30/100