space b/w glyph in true type font is not proper
| From: | Prashant Sharma | Date: | Tue, 12 Jan 2010 17:21:50 +0000 |
| Subject: | space b/w glyph in true type font is not proper | ||
| Groups: | php.gd.devel | ||
| Request: | Send a blank email to php-gd-devel+get-634@lists.php.net to get a copy of this message | ||
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