PHWinfo banniere

Titres
PORTAIL ANNUAIRE ARTICLES COMPARATEUR HÉBERGEURS DEVIS FORUMS RÉDUCTEUR D'URL
Précédent   PHWinfo > Autres forums > Forum Programmation & Conception > php.general > GD / Pixel Font Rendering
S'inscrire FAQ Membres Recherche Messages du jour Marquer les forums comme lus
GD / Pixel Font Rendering

Réponse
 
LinkBack Outils de la discussion
Vieux 16/03/2008, 00h56   #1
nihilism machine
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut GD / Pixel Font Rendering

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?
  Réponse avec citation
Vieux 17/03/2008, 09h25   #2
Jochem Maas
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: [PHP] GD / Pixel Font Rendering

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.
use '8' instead of '20' for the fontsize.

>


  Réponse avec citation
Vieux 17/03/2008, 12h15   #3
Børge Holen
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: [PHP] GD / Pixel Font Rendering

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.
This list has the tendancy to send double posts from time to time.

> use '8' instead of '20' for the fontsize.




--
---
Børge Holen
http://www.arivene.net
  Réponse avec citation
Vieux 17/03/2008, 13h10   #4
Jochem Maas
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: [PHP] GD / Pixel Font Rendering

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.

>
>
>


  Réponse avec citation
Vieux 17/03/2008, 13h26   #5
Børge Holen
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: [PHP] GD / Pixel Font Rendering

On Monday 17 March 2008 13:10:20 Jochem Maas wrote:
> 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 ;-)


THAT on the other hand is a perfectly good reason to kick the shit out of
someone =D

>
> > 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.




--
---
Børge Holen
http://www.arivene.net
  Réponse avec citation
Réponse


Outils de la discussion

Règles de messages
Vous ne pouvez pas créer de nouvelles discussions
Vous ne pouvez pas envoyer des réponses
Vous ne pouvez pas envoyer des pièces jointes
Vous ne pouvez pas modifier vos messages

Les balises BB sont activées : oui
Les smileys sont activés : oui
La balise [IMG] est activée : oui
Le code HTML peut être employé : non
Trackbacks are oui
Pingbacks are oui
Refbacks are oui


Fuseau horaire GMT +1. Il est actuellement 10h15.


Édité par : vBulletin® version 3.7.3
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.2.0 RC5 Tous droits réservés.
Version française #16 par l'association vBulletin francophone
PHWinfo est un site Éducation Sans Frontières ©2000-2008
Ad Management by RedTyger
©Tous droits réservés par les parties respectives
Page generated in 0,15273 seconds with 13 queries