php-doc-en/reference/image/functions/imagettfbbox.xml
2005-08-18 16:09:37 +00:00

137 lines
3.9 KiB
XML

<?xml version="1.0" encoding="iso-8859-1"?>
<!-- $Revision: 1.7 $ -->
<!-- splitted from ./en/functions/image.xml, last change in rev 1.2 -->
<refentry id="function.imagettfbbox">
<refnamediv>
<refname>imagettfbbox</refname>
<refpurpose>Give the bounding box of a text using TrueType fonts</refpurpose>
</refnamediv>
<refsect1>
<title>Description</title>
<methodsynopsis>
<type>array</type><methodname>imagettfbbox</methodname>
<methodparam><type>float</type><parameter>size</parameter></methodparam>
<methodparam><type>float</type><parameter>angle</parameter></methodparam>
<methodparam><type>string</type><parameter>fontfile</parameter></methodparam>
<methodparam><type>string</type><parameter>text</parameter></methodparam>
</methodsynopsis>
<para>
This function calculates and returns the bounding box in pixels
for a TrueType text.
<variablelist>
<varlistentry>
<term>
<parameter>size</parameter>
</term>
<listitem>
<simpara>The font size in pixels.</simpara>
</listitem>
</varlistentry>
<varlistentry>
<term>
<parameter>angle</parameter>
</term>
<listitem>
<simpara>
Angle in degrees in which <parameter>text</parameter> will be
measured.
</simpara>
</listitem>
</varlistentry>
<varlistentry>
<term>
<parameter>fontfile</parameter>
</term>
<listitem>
<simpara>
The name of the TrueType font file (can be a 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.
</simpara>
</listitem>
</varlistentry>
<varlistentry>
<term>
<parameter>text</parameter>
</term>
<listitem>
<simpara>The string to be measured.</simpara>
</listitem>
</varlistentry>
</variablelist>
<function>imagettfbbox</function> returns an array with 8
elements representing four points making the bounding box of the
text:
<informaltable>
<tgroup cols="2">
<tbody>
<row>
<entry>0</entry>
<entry>lower left corner, X position</entry>
</row>
<row>
<entry>1</entry>
<entry>lower left corner, Y position</entry>
</row>
<row>
<entry>2</entry>
<entry>lower right corner, X position</entry>
</row>
<row>
<entry>3</entry>
<entry>lower right corner, Y position</entry>
</row>
<row>
<entry>4</entry>
<entry>upper right corner, X position</entry>
</row>
<row>
<entry>5</entry>
<entry>upper right corner, Y position</entry>
</row>
<row>
<entry>6</entry>
<entry>upper left corner, X position</entry>
</row>
<row>
<entry>7</entry>
<entry>upper left corner, Y position</entry>
</row>
</tbody>
</tgroup>
</informaltable>
The points are relative to the <emphasis>text</emphasis>
regardless of the angle, so "upper left" means in the top
left-hand corner seeing the text horizontally.
</para>
<para>
This function requires both the GD library and the FreeType
library.
</para>
<para>
See also <function>imagettftext</function>.
</para>
</refsect1>
</refentry>
<!-- Keep this comment at the end of the file
Local variables:
mode: sgml
sgml-omittag:t
sgml-shorttag:t
sgml-minimize-attributes:nil
sgml-always-quote-attributes:t
sgml-indent-step:1
sgml-indent-data:t
indent-tabs-mode:nil
sgml-parent-document:nil
sgml-default-dtd-file:"../../../../manual.ced"
sgml-exposed-tags:nil
sgml-local-catalogs:nil
sgml-local-ecat-files:nil
End:
vim600: syn=xml fen fdm=syntax fdl=2 si
vim: et tw=78 syn=sgml
vi: ts=1 sw=1
-->