1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137
|
<?xml version="1.0" encoding="iso-8859-1"?>
<!-- $Revision: 1.6 $ -->
<!-- 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>text</parameter>
</term>
<listitem>
<simpara>The string to be measured.</simpara>
</listitem>
</varlistentry>
<varlistentry>
<term>
<parameter>size</parameter>
</term>
<listitem>
<simpara>The font size in pixels.</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>angle</parameter>
</term>
<listitem>
<simpara>
Angle in degrees in which <parameter>text</parameter> will 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
-->
|