Re: GD / Pixel Font Rendering

From: Date: Mon, 17 Mar 2008 12:10:20 +0000
Subject: Re: GD / Pixel Font Rendering
References: 1 2 3  Groups: php.general 
Request: Send a blank email to php-general+get-271681@lists.php.net to get a copy of this message
Børge Holen schreef:
On Monday 17 March 2008 09:25:36 Jochem Maas wrote:
nihilism machine schreef:
I am trying to render an 8 pixel pixel font without anti aliasing to look crisp (silkscreen) in 8pt with gd. the font is huge and ugly: <?php // Set the content-type header("Content-type: image/png"); // Create the image $im = imagecreatetruecolor(400, 30); // Create some colors $white = imagecolorallocate($im, 255, 255, 255); $grey = imagecolorallocate($im, 128, 128, 128); $black = imagecolorallocate($im, 0, 0, 0); imagefilledrectangle($im, 0, 0, 399, 29, $white); // The text to draw $text = 'Testing...'; // Replace path by your own font path $font = 'silkscreen.ttf'; // Add some shadow to the text imagettftext($im, 20, 0, 11, 21, $grey, $font, $text); // Add the text imagettftext($im, 20, 0, 10, 20, $black, $font, $text); // Using imagepng() results in clearer text compared with imagejpeg() imagepng($im); imagedestroy($im); ?> -- any ideas?
don't post twice.
I recon he didn't.
maybe, maybe not. I get punished for stuff I didn't do all the time ... why shouldn't he ;-)
This list has the tendancy to send double posts from time to time.
it does? haven't noticed that. I'll be more vigilant (well I'll try)
use '8' instead of '20' for the fontsize.


« previous php.general (#271681) next »