Re: [GD-DEVEL] Problem with TTF file
| From: | Takeshi Abe | Date: | Sat, 18 Oct 2008 08:25:35 +0000 |
| Subject: | Re: [GD-DEVEL] Problem with TTF file | ||
| References: | 1 | Groups: | php.gd.devel |
| Request: | Send a blank email to php-gd-devel+get-484@lists.php.net to get a copy of this message | ||
Hi,
On Thu, 16 Oct 2008 21:14:43 +0200, "Marco van Oostende" <moostende@gmail.com>
wrote:
> function create_image() {
> header('Content-type: image/png');
> $box = ImageTTFbbox($this->fontsize, 0, $this->fontfile, $this->article);
> $src_img = ImageCreate(($box[2]+11), (abs($box[7]-$box[1])+6));
> $black = ImageColorAllocate($src_img, 0x00, 0x00, 0x00);
> $white = ImageColorAllocate($src_img, 0xff, 0xff, 0xff);
> ImageFill($src_img, 0, 0, $white);
> ImageColorTransparent($src_img, $white);
> ImageTTFText($src_img, $this->fontsize, 0, 3, abs($box[7]), $black,
> $this->fontfile, $this->article);
> ImagePNG($src_img);
> ImageDestroy($src_img);
> }
(snip)
>
> The GPL font file I use can be downloaded from 'grandzebu dot net
> slash informatique slash codbar slash ean13 dot ttf' and the string to
> put in $this->article for testing is 3FJQRLA*cbgahj+
The above function seems to work well on my Debian lenny with php5-gd
(php 5.2.6 + gd 2.0.35), resulting the attached png.
Cheers,
-- Takeshi Abe