★ wanayoo — archive 1999 http://www.php.net/manual/fr/function.imagettftext.phpNouvelle recherche | Portail wanayoo

PHP Home Page

Manual Table of Contents
Up to Graphisme
Quick Reference
English version of this pageGerman version of this pageJapanese version of this pageItalian version of this pageHungarian version of this page
Graphisme
* GetImageSize
* ImageArc
* ImageChar
* ImageCharUp
* ImageColorAllocate
* ImageColorAt
* ImageColorClosest
* ImageColorExact
* ImageColorResolve
* ImageColorSet
* ImageColorsForIndex
* ImageColorsTotal
* ImageColorTransparent
* ImageCopyResized
* ImageCreate
* ImageCreateFromGif
* ImageDashedLine
* ImageDestroy
* ImageFill
* ImageFilledPolygon
* ImageFilledRectangle
* ImageFillToBorder
* ImageFontHeight
* ImageFontWidth
* ImageGif
* ImageInterlace
* ImageLine
* ImageLoadFont
* ImagePolygon
* ImagePSBBox
* ImagePSEncodeFont
* ImagePSFreeFont
* ImagePSLoadFont
* ImagePSText
* ImageRectangle
* ImageSetPixel
* ImageString
* ImageStringUp
* ImageSX
* ImageSY
* ImageTTFBBox
* ImageTTFText
Manual: ImageTTFText
View the source code for this pageSearch the site



Previous page
 ImageTTFBBox
 Updated
Sun, 06 Aug 2000
IMAP 
Next page


ImageTTFText

(unknown)

ImageTTFText -- Dessine un texte avec une police TrueType.

Description

array ImageTTFText (int im, int size, int angle, int x, int y, int col, string fontfile, string text)

ImageTTFText() dessine la chaîne text dans l'image im, en commancant aux coordonnées (x,y) (le coin supérieur gauche est l'origine (0,0)), avec un angle de angle, et dans la couleur col, en utilisant la police TrueType identifiée par fontfile.

Les coordonnées (x,y) serviront de référence pour le premier caractère (en gros, le coin inférieur gauche du caractère). C'est différent de ImageString(), qui utilise le coin supérieur droit.

angle est donné en degrés, avec degré 0 pour un texte horizontal, et en comptant les angles dans le sens inverse des aiguilles d'une montre (sens direct).

fontfile est le chemin jusqu'à la police TrueType à utiliser.

text est le texte à dessiner, incluant aussi des séquences de caractères UTF-8 (de la forme: { ) pour générer des caractères au delà de 255.

col est l'index de la couleur dans la palette. Utiliser des index négatifs, revient à supprimer l'anti-aliasing.

ImageTTFText() retourne un tableau de 8 éléments représentants les 4 points marquant les limites du texte. L'ordre des points est :supérieur gauche, supérieur droit, inférieur droit, inférieur gauche. Les points sont nommés relativement au texte à l'horizontal.

Cet exemple va générer une image GIF noire de 400x30 pixels, avec les mots "Test en cours..." en police blanche, Arial.

Exemple 1. ImageTTFText


<?php
Header("Content-type: image/gif");
$im = imagecreate(400,30);
$black = ImageColorAllocate($im, 0,0,0);
$white = ImageColorAllocate($im, 255,255,255);
ImageTTFText($im, 20, 0, 10, 20, $white, "/path/arial.ttf", "Test en cours... Omega: &#937;");
ImageGif($im);
ImageDestroy($im);
?>

Cette fonction requiert les bibliothèques GD et FreeType.

Voir aussi ImageTTFBBox().


User Contributed Notes: ImageTTFText


icon@mricon.com
22-Jul-1999 11:46
As it says, to operate TTF fonts, you will need FreeType libraries before you compile PHP. On RedHat Linux systems you need to make sure you have both FreeType and FreeType-devel RPM packages installed. The configure script will locate FreeType libraries and automagically compile with TTF support. Tested on RedHat-6.0 with FreeType-1.2.


icon@mricon.com
22-Jul-1999 11:58
TTF fonts that don't contain a Unicode mapping table won't work. E.g. wingdings... Overall, if your images don't show up and you can't figure out what it is, it's a good idea to quote out Header("Content-type: image/gif") to see if any error information is generated.


brian@bkw.org
27-Sep-1999 11:43
It says you have to recompile apache to add both GD and FreeType to your Apache/PHP... I didnt have too! hmm I wonder why it worked! :)


icon@mricon.com
15-Feb-2000 10:08
For fellow cyrillic users. If you're looking for a way to painlessly make this work with Russian fonts, check out the page I set up: http://www.mricon.com/cyrttf.html


j.schmitz@web.de
22-Feb-2000 12:47
Ok, after wasting my time in finding a hack to disable anti aliasing I found a feature in the source: set a negativ color number and anti aliasing is disabled - simply write ImageTTFText(.....,-$mycolor,....)


kevin@nsane.net
26-Mar-2000 04:34
The aliasing is terrible. I hope freetype2 support comes soon.


imacs@email.com
06-Apr-2000 02:16
to make it support chinese and japaness font,
have a look here.
<a href=/old?u=http%3A%2F%2Fwww.php.net%2Fmanual%2Ffr%2F%26quot%3Bhttp%3A%2Fwww.freshmeat.net%2Fappindex%2F1999%2F12%2F27%2F946305846.html%26quot%3B%26gt%3Bhttp%3A%2Fwww.freshmeat.net%2Fappindex%2F1999%2F12%2F27%2F946305846.html%26lt%3B%2Fa%26gt%3B%3C%2Ftt&y=1999>


natematias@juno.com
28-Jul-2000 06:15
Keep in mind that if you load an external image you need to take your text colors from the external image's pallete using
<pre>$color=imagecolorat($image, $xcoord, $ycoord);</pre>



inane@phreaker.net
30-Jul-2000 05:42
as above, it says to go here to find out how to make php support japanese and chinese support...
well... i can get it to support japanese in EUC only, not in SJIS or JIS... and i cannot get chinese to work at all and i would like korean to work as well... anyone else know any sites or ways to add chinese, japanese, and korean support?



soojin001@kebi.com
07-Aug-2000 10:28
¿©±â¿¡ ¾ÆÁ÷ ÇѱÛÀº º¸ÀÌÁö ¾Ê³×¿ä..
imagettftext() ÇÔ¼ö¿¡ °üÇØ¼­ ¾Ë¾Æº¸´Â Áß¿¡
¿©±â ±îÁö ¿Ô´Âµ¥....¸îÀÚ ³²±â°í°©´Ï´Ù...

Be Happy !!




soojin001@kebi.com
07-Aug-2000 10:33
Á¶±ÝÀü¿¡ ±ÛÀ» Àû¾ú´Âµ¥ ¾Èº¸À̳׿ä..
imagettftext() ÇÑ±Û Áö¿ø¿¡ °üÇØ¼­...
http://my.netian.com/~mischoi/mischoi.zip
ÀÌ ÆÄÀÏ ¹Þ¾Æ º¸¼¼¿ä..gif ÇѱÛÀÌ °¡´É ÇØÁú°Ì´Ï´Ù.Àúµµ ´Ù¿î ¹ÞÀº °Ì´Ï´Ù. Àü ´Ù¸¥ ¹®Á¦ ¶§¹®¿¡ ¿©±â ¿Ô´Âµ¥....



 About Notes


Previous page
 ImageTTFBBox
 Updated
Sun, 06 Aug 2000
IMAP 
Next page





Who's responsible for this?
Top of this page

Site
Hosting:



Located in
United States
Elements of this website are subject to copyright.
Questions about installing or using PHP should be directed to one of the mailing lists.
Only questions about the website should be directed to webmaster@php.net.