Sophie

Sophie

distrib > Mandriva > 9.1 > ppc > media > main > by-pkgid > 0afeee9cca140e167a996902b9a677c5 > files > 1111

php-manual-en-4.3.0-2mdk.noarch.rpm

<HTML
><HEAD
><TITLE
>imagettftext</TITLE
><META
NAME="GENERATOR"
CONTENT="Modular DocBook HTML Stylesheet Version 1.7"><LINK
REL="HOME"
TITLE="PHP Manual"
HREF="index.html"><LINK
REL="UP"
TITLE="Image functions"
HREF="ref.image.html"><LINK
REL="PREVIOUS"
TITLE="imagettfbbox"
HREF="function.imagettfbbox.html"><LINK
REL="NEXT"
TITLE="imagetypes"
HREF="function.imagetypes.html"><META
HTTP-EQUIV="Content-type"
CONTENT="text/html; charset=ISO-8859-1"></HEAD
><BODY
CLASS="refentry"
BGCOLOR="#FFFFFF"
TEXT="#000000"
LINK="#0000FF"
VLINK="#840084"
ALINK="#0000FF"
><DIV
CLASS="NAVHEADER"
><TABLE
SUMMARY="Header navigation table"
WIDTH="100%"
BORDER="0"
CELLPADDING="0"
CELLSPACING="0"
><TR
><TH
COLSPAN="3"
ALIGN="center"
>PHP Manual</TH
></TR
><TR
><TD
WIDTH="10%"
ALIGN="left"
VALIGN="bottom"
><A
HREF="function.imagettfbbox.html"
ACCESSKEY="P"
>Prev</A
></TD
><TD
WIDTH="80%"
ALIGN="center"
VALIGN="bottom"
></TD
><TD
WIDTH="10%"
ALIGN="right"
VALIGN="bottom"
><A
HREF="function.imagetypes.html"
ACCESSKEY="N"
>Next</A
></TD
></TR
></TABLE
><HR
ALIGN="LEFT"
WIDTH="100%"></DIV
><H1
><A
NAME="function.imagettftext"
></A
>imagettftext</H1
><DIV
CLASS="refnamediv"
><A
NAME="AEN36808"
></A
><P
>    (PHP 3, PHP 4 )</P
>imagettftext&nbsp;--&nbsp;Write text to the image using TrueType fonts</DIV
><DIV
CLASS="refsect1"
><A
NAME="AEN36811"
></A
><H2
>Description</H2
>array <B
CLASS="methodname"
>imagettftext</B
> ( resource im, int size, int angle, int x, int y, int col, string fontfile, string text)<BR
></BR
><P
>&#13;     <B
CLASS="function"
>imagettftext()</B
> draws the string
     <TT
CLASS="parameter"
><I
>text</I
></TT
> in the image identified by
     <TT
CLASS="parameter"
><I
>image</I
></TT
>, starting at coordinates
     <TT
CLASS="parameter"
><I
>x</I
></TT
>, <TT
CLASS="parameter"
><I
>y</I
></TT
> (top left is 0, 0), at
     an angle of <TT
CLASS="parameter"
><I
>angle</I
></TT
> in color
     <TT
CLASS="parameter"
><I
>col</I
></TT
>, using the TrueType font file identified by
     <TT
CLASS="parameter"
><I
>fontfile</I
></TT
>. Depending on which version of the GD
     library that PHP is using, when <TT
CLASS="parameter"
><I
>fontfile</I
></TT
> does not
     begin with a leading '/',  '.ttf' will be appended to the filename and
     the library will attempt to search for that filename along a
     library-defined font path.
    </P
><P
>&#13;     The coordinates given by <TT
CLASS="parameter"
><I
>x</I
></TT
>,
     <TT
CLASS="parameter"
><I
>y</I
></TT
> will define the basepoint of the first
     character (roughly the lower-left corner of the character).  This
     is different from the <A
HREF="function.imagestring.html"
><B
CLASS="function"
>imagestring()</B
></A
>, where x,
     y define the upper-right corner of the first character.
    </P
><P
>&#13;     <TT
CLASS="parameter"
><I
>angle</I
></TT
> is in degrees, with 0 degrees being
     left-to-right reading text (3 o'clock direction), and higher
     values representing a counter-clockwise rotation.  (i.e., a value
     of 90 would result in bottom-to-top reading text).
    </P
><P
>&#13;     <TT
CLASS="parameter"
><I
>fontfile</I
></TT
> is the path to the TrueType font
     you wish to use.
    </P
><P
>&#13;     <TT
CLASS="parameter"
><I
>text</I
></TT
> is the text string which may include
     UTF-8 character sequences (of the form: &#38;#123;) to access
     characters in a font beyond the first 255.
    </P
><P
>&#13;     <TT
CLASS="parameter"
><I
>Col</I
></TT
> is the color index.  Using the
     negative of a color index has the effect of turning off
     antialiasing.
    </P
><P
>&#13;     <B
CLASS="function"
>imagettftext()</B
> returns an array with 8
     elements representing four points making the bounding box of the
     text.  The order of the points is lower left, lower right, upper
     right, upper left. The points are relative to the text
     regardless of the angle, so "upper left" means in the top
     left-hand corner when you see the text horizontallty.
    </P
><P
>&#13;     This example script will produce a black GIF 400x30 pixels, with
     the words "Testing..."  in white in the font Arial.
     <TABLE
WIDTH="100%"
BORDER="0"
CELLPADDING="0"
CELLSPACING="0"
CLASS="EXAMPLE"
><TR
><TD
><DIV
CLASS="example"
><A
NAME="AEN36865"
></A
><P
><B
>Example 1. <B
CLASS="function"
>imagettftext()</B
> example</B
></P
><TABLE
BORDER="0"
BGCOLOR="#E0E0E0"
CELLPADDING="5"
><TR
><TD
><PRE
CLASS="php"
>&#60;?php
  header("Content-type: image/jpeg");
  $im = imagecreate(400,30);
  $white = imagecolorallocate($im, 255,255,255);
  $black = imagecolorallocate($im, 0,0,0);
  
  // Replace path by your own font path
  imagettftext($im, 20, 0, 10, 20, $black, "/path/arial.ttf",
  "Testing... Omega: &#38;amp;#937;");
  imagejpeg($im);
  imagedestroy($im);
?&#62;</PRE
></TD
></TR
></TABLE
></DIV
></TD
></TR
></TABLE
>
    </P
><P
>&#13;     This function requires both the GD library and the <A
HREF="http://www.freetype.org/"
TARGET="_top"
>FreeType</A
> library.
    </P
><P
>&#13;     See also <A
HREF="function.imagettfbbox.html"
><B
CLASS="function"
>imagettfbbox()</B
></A
>.
    </P
></DIV
><DIV
CLASS="NAVFOOTER"
><HR
ALIGN="LEFT"
WIDTH="100%"><TABLE
SUMMARY="Footer navigation table"
WIDTH="100%"
BORDER="0"
CELLPADDING="0"
CELLSPACING="0"
><TR
><TD
WIDTH="33%"
ALIGN="left"
VALIGN="top"
><A
HREF="function.imagettfbbox.html"
ACCESSKEY="P"
>Prev</A
></TD
><TD
WIDTH="34%"
ALIGN="center"
VALIGN="top"
><A
HREF="index.html"
ACCESSKEY="H"
>Home</A
></TD
><TD
WIDTH="33%"
ALIGN="right"
VALIGN="top"
><A
HREF="function.imagetypes.html"
ACCESSKEY="N"
>Next</A
></TD
></TR
><TR
><TD
WIDTH="33%"
ALIGN="left"
VALIGN="top"
>imagettfbbox</TD
><TD
WIDTH="34%"
ALIGN="center"
VALIGN="top"
><A
HREF="ref.image.html"
ACCESSKEY="U"
>Up</A
></TD
><TD
WIDTH="33%"
ALIGN="right"
VALIGN="top"
>imagetypes</TD
></TR
></TABLE
></DIV
></BODY
></HTML
>