<HTML ><HEAD ><TITLE >imagettfbbox</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="imagetruecolortopalette" HREF="function.imagetruecolortopalette.html"><LINK REL="NEXT" TITLE="imagettftext" HREF="function.imagettftext.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.imagetruecolortopalette.html" ACCESSKEY="P" >Prev</A ></TD ><TD WIDTH="80%" ALIGN="center" VALIGN="bottom" ></TD ><TD WIDTH="10%" ALIGN="right" VALIGN="bottom" ><A HREF="function.imagettftext.html" ACCESSKEY="N" >Next</A ></TD ></TR ></TABLE ><HR ALIGN="LEFT" WIDTH="100%"></DIV ><H1 ><A NAME="function.imagettfbbox" ></A >imagettfbbox</H1 ><DIV CLASS="refnamediv" ><A NAME="AEN36732" ></A ><P > (PHP 3>= 3.0.1, PHP 4 )</P >imagettfbbox -- Give the bounding box of a text using TrueType fonts</DIV ><DIV CLASS="refsect1" ><A NAME="AEN36735" ></A ><H2 >Description</H2 >array <B CLASS="methodname" >imagettfbbox</B > ( int size, int angle, string fontfile, string text)<BR ></BR ><P > This function calculates and returns the bounding box in pixels for a TrueType text. <P ></P ><DIV CLASS="variablelist" ><DL ><DT ><TT CLASS="parameter" ><I >text</I ></TT ></DT ><DD ><P >The string to be measured.</P ></DD ><DT ><TT CLASS="parameter" ><I >size</I ></TT ></DT ><DD ><P >The font size in pixels.</P ></DD ><DT ><TT CLASS="parameter" ><I >fontfile</I ></TT ></DT ><DD ><P > The name of the TrueType font file. (Can also be an URL.) Depending on which version of the GD library that PHP is using, it may attempt to search for files that do not begin with a leading '/' by appending '.ttf' to the filename and searching along a library-defined font path. </P ></DD ><DT ><TT CLASS="parameter" ><I >angle</I ></TT ></DT ><DD ><P > Angle in degrees in which <TT CLASS="parameter" ><I >text</I ></TT > will be measured. </P ></DD ></DL ></DIV > <B CLASS="function" >imagettfbbox()</B > returns an array with 8 elements representing four points making the bounding box of the text: <DIV CLASS="informaltable" ><A NAME="AEN36776" ></A ><P ></P ><TABLE BORDER="1" CLASS="CALSTABLE" ><TBODY ><TR ><TD ALIGN="LEFT" VALIGN="MIDDLE" >0</TD ><TD ALIGN="LEFT" VALIGN="MIDDLE" >lower left corner, X position</TD ></TR ><TR ><TD ALIGN="LEFT" VALIGN="MIDDLE" >1</TD ><TD ALIGN="LEFT" VALIGN="MIDDLE" >lower left corner, Y position</TD ></TR ><TR ><TD ALIGN="LEFT" VALIGN="MIDDLE" >2</TD ><TD ALIGN="LEFT" VALIGN="MIDDLE" >lower right corner, X position</TD ></TR ><TR ><TD ALIGN="LEFT" VALIGN="MIDDLE" >3</TD ><TD ALIGN="LEFT" VALIGN="MIDDLE" >lower right corner, Y position</TD ></TR ><TR ><TD ALIGN="LEFT" VALIGN="MIDDLE" >4</TD ><TD ALIGN="LEFT" VALIGN="MIDDLE" >upper right corner, X position</TD ></TR ><TR ><TD ALIGN="LEFT" VALIGN="MIDDLE" >5</TD ><TD ALIGN="LEFT" VALIGN="MIDDLE" >upper right corner, Y position</TD ></TR ><TR ><TD ALIGN="LEFT" VALIGN="MIDDLE" >6</TD ><TD ALIGN="LEFT" VALIGN="MIDDLE" >upper left corner, X position</TD ></TR ><TR ><TD ALIGN="LEFT" VALIGN="MIDDLE" >7</TD ><TD ALIGN="LEFT" VALIGN="MIDDLE" >upper left corner, Y position</TD ></TR ></TBODY ></TABLE ><P ></P ></DIV > The points are relative to the <SPAN CLASS="emphasis" ><I CLASS="emphasis" >text</I ></SPAN > regardless of the angle, so "upper left" means in the top left-hand corner seeing the text horizontallty. </P ><P > This function requires both the GD library and the FreeType library. </P ><P > See also <A HREF="function.imagettftext.html" ><B CLASS="function" >imagettftext()</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.imagetruecolortopalette.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.imagettftext.html" ACCESSKEY="N" >Next</A ></TD ></TR ><TR ><TD WIDTH="33%" ALIGN="left" VALIGN="top" >imagetruecolortopalette</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" >imagettftext</TD ></TR ></TABLE ></DIV ></BODY ></HTML >