Page 1 of 1

imagettftext not working with trajanpro.ttf

Posted: Fri Jul 30, 2010 1:13 am
by jawedshamshedi
Hi All,
I am getting this problem for one of my site that i am developing .
When I insert special characters string like thi's ~!@#$%^&*()_+| the code is unable to convert it into right image with all text on it when the chosen font in trajanpro.ttf, but when I change the font with Ariel it work's fine.
If anyone want to check this problem then you can check at this link

http://www.centralstationery.com/produc ... ate_id=231

Click the text on card and a pop up will open and then change the font to Ariel then the image on card will be converted into right text.

The code is

Code: Select all

        imageSaveAlpha($image, true);
	ImageAlphaBlending($image, false);
	$bgcolor = imagecolorallocate($image, 200, 200, 200);
	$transparentColor = imagecolorallocatealpha($image, 200, 200, 200, 127);
	imagefill($image, 0, 0, $transparentColor);
	// pick color for the text
	$fontcolor = imagecolorallocate($image, $red, $grn, $blu);

	// fill in the background with the background color
	imagefilledrectangle($image, 0, 0, $width, $height, $transparentColor);
       $x = 0; 
	$y = $fontsize;
	imagettftext($image, $fontsize, 0, $bx, $by, $fontcolor, $font, $quote);
	

	$final_image=DIR_USER_EDITOR.$new_image;

	// output image to the browser
	imagepng($image, $final_image);

	// delete the image resource 
	imagedestroy($image);