Re: [GD-DEVEL] space b/w glyph in true type font is not proper

[email protected] (Pierre Joye) Wed, 13 Jan 2010 12:03:23 +0100
Newsgroups php.gd.devel
Message-ID <[email protected]>
hi,

I don't see the attachments, can you send the mail again with the
attachments please?

Cheers,

On Tue, Jan 12, 2010 at 6:21 PM, Prashant Sharma <[email protected]> wrote:
>
> Hi,
> If I use php build of gd, space b/w characters of string is proper.
> However, when I use gd C library, the space is not proper.
> PHP code:
> ------------------------------------------
> <?php
> $im = imagecreatetruecolor(100,100);
>  $white = imagecolorallocate($im, 255, 255, 255);
>  $grey = imagecolorallocate($im, 128, 128, 128);
>  $black = imagecolorallocate($im, 0, 0, 0);
>  imagefilledrectangle($im, 0, 0, 100, 100, $white);
>  $text = 'Yahoo';
>  $font = '/tmp/arial.ttf';
>  imagettftext($im, 8, 0, 10, 10, $black, $font, $text);
>  imagepng($im,"/tmp/test.png");
>  imagedestroy($im);
>  ?>
> ------------------------------------------
>
> C code:
> ------------------------------------------
> #include <gd.h>
> #include <stdio.h>
> #include <fstream>
> #include <gdfonts.h>
> //g++ code.cc -I/usr/local/include -lgd  -L/usr/local/lib
>
> int main(int argc, char *argv[]) {
>     gdImagePtr im = gdImageCreateTrueColor(100,100);
>     int white = gdImageColorResolve(im, 255, 255, 255);
>     int black = gdImageColorResolve(im, 0, 0, 0);
>     gdImageFilledRectangle(im,0,0,100,100,white);
>     gdImageStringFT(im,NULL,black,"./arial.ttf",8,0.0,10,10,"Yahoo");
>     FILE *pngout = fopen("test.png", "wb");
>     gdImagePng(im, pngout);
>     fclose(pngout);
>     gdImageDestroy(im);
> }
> ------------------------------------------
>
> C library version used: gd-2.0.36_2,1
> PHP info:
> Array
> (
>     [GD Version] => bundled (2.0.34 compatible)
>     [FreeType Support] => 1
>     [FreeType Linkage] => with freetype
>     [T1Lib Support] => 1
>     [GIF Read Support] => 1
>     [GIF Create Support] => 1
>     [JPG Support] => 1
>     [PNG Support] => 1
>     [WBMP Support] => 1
>     [XPM Support] =>
>     [XBM Support] => 1
>     [JIS-mapped Japanese Font Support] =>
> )
>
> Attaching the images for php & C library also.
> What I am missing here?
> Regards
> Prashant
>
> --
> GD Devel Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>



-- 
Pierre

@pierrejoye | http://blog.thepimp.net | http://www.libgd.org