reference/image/functions/imagefttext.xml
213fbd9440a224f9c1da4942c85124ce0c120c52
...
...
@@ -1,6 +1,6 @@
1
1
<?xml version="1.0" encoding="utf-8"?>
2
2
<!-- $Revision$ -->
3
-
<refentry xml:id='function.imagefttext' xmlns="http://docbook.org/ns/docbook">
3
+
<refentry xml:id="function.imagefttext" xmlns="http://docbook.org/ns/docbook">
4
4
<refnamediv>
5
5
<refname>imagefttext</refname>
6
6
<refpurpose>Write text to the image using fonts using FreeType 2</refpurpose>
...
...
@@ -8,17 +8,25 @@
8
8
<refsect1 role="description">
9
9
&reftitle.description;
10
10
<methodsynopsis>
11
-
<type>array</type><methodname>imagefttext</methodname>
12
-
<methodparam><type>resource</type><parameter>image</parameter></methodparam>
11
+
<type class="union"><type>array</type><type>false</type></type><methodname>imagefttext</methodname>
12
+
<methodparam><type>GdImage</type><parameter>image</parameter></methodparam>
13
13
<methodparam><type>float</type><parameter>size</parameter></methodparam>
14
14
<methodparam><type>float</type><parameter>angle</parameter></methodparam>
15
15
<methodparam><type>int</type><parameter>x</parameter></methodparam>
16
16
<methodparam><type>int</type><parameter>y</parameter></methodparam>
17
17
<methodparam><type>int</type><parameter>color</parameter></methodparam>
18
-
<methodparam><type>string</type><parameter>fontfile</parameter></methodparam>
18
+
<methodparam><type>string</type><parameter>font_filename</parameter></methodparam>
19
19
<methodparam><type>string</type><parameter>text</parameter></methodparam>
20
-
<methodparam choice="opt"><type>array</type><parameter>extrainfo</parameter></methodparam>
20
+
<methodparam choice="opt"><type>array</type><parameter>options</parameter><initializer>[]</initializer></methodparam>
21
21
</methodsynopsis>
22
+
<note>
23
+
<para>
24
+
Prior to PHP 8.0.0, <function>imagefttext</function> was an extended variant of
25
+
<function>imagettftext</function> which additionally supported the
26
+
<parameter>options</parameter>.
27
+
As of PHP 8.0.0, <function>imagettftext</function> is an alias of <function>imagefttext</function>.
28
+
</para>
29
+
</note>
22
30
</refsect1>
23
31
<refsect1 role="parameters">
24
32
&reftitle.parameters;
...
...
@@ -76,32 +84,25 @@
76
84
</listitem>
77
85
</varlistentry>
78
86
<varlistentry>
79
-
<term><parameter>fontfile</parameter></term>
87
+
<term><parameter>font_filename</parameter></term>
80
88
<listitem>
81
89
<para>
82
90
The path to the TrueType font you wish to use.
83
91
</para>
84
92
<para>
85
93
Depending on which version of the GD library PHP is using, <emphasis>when
86
-
<parameter>fontfile</parameter> does not begin with a leading
94
+
<parameter>font_filename</parameter> does not begin with a leading
87
95
<literal>/</literal> then <literal>.ttf</literal> will be appended</emphasis>
88
96
to the filename and the library will attempt to search for that
89
97
filename along a library-defined font path.
90
98
</para>
91
99
<para>
92
-
When using versions of the GD library lower than 2.0.18, a <literal>space</literal> character,
93
-
rather than a semicolon, was used as the 'path separator' for different font files.
94
-
Unintentional use of this feature will result in the warning message:
95
-
<literal>Warning: Could not find/open font</literal>. For these affected versions, the
96
-
only solution is moving the font to a path which does not contain spaces.
97
-
</para>
98
-
<para>
99
100
In many cases where a font resides in the same directory as the script using it
100
101
the following trick will alleviate any include problems.
101
102
<programlisting role="php">
102
103
<![CDATA[
103
104
<?php
104
-
// Set the enviroment variable for GD
105
+
// Set the environment variable for GD
105
106
putenv('GDFONTPATH=' . realpath('.'));
106
107

107
108
// Name the font to be used (note the lack of the .ttf extension)
...
...
@@ -121,11 +122,11 @@ $font = 'SomeFont';
121
122
</listitem>
122
123
</varlistentry>
123
124
<varlistentry>
124
-
<term><parameter>extrainfo</parameter></term>
125
+
<term><parameter>options</parameter></term>
125
126
<listitem>
126
127
<para>
127
128
<table>
128
-
<title>Possible array indexes for <parameter>extrainfo</parameter></title>
129
+
<title>Possible array indexes for <parameter>options</parameter></title>
129
130
<tgroup cols="2">
130
131
<thead>
131
132
<row>
...
...
@@ -192,7 +193,28 @@ $font = 'SomeFont';
192
193
</tgroup>
193
194
</informaltable>
194
195
</para>
196
+
<para>
197
+
On failure, &false; is returned.
198
+
</para>
195
199
</refsect1>
200
+

201
+
<refsect1 role="changelog">
202
+
&reftitle.changelog;
203
+
<informaltable>
204
+
<tgroup cols="2">
205
+
<thead>
206
+
<row>
207
+
<entry>&Version;</entry>
208
+
<entry>&Description;</entry>
209
+
</row>
210
+
</thead>
211
+
<tbody>
212
+
&gd.changelog.image-param;
213
+
</tbody>
214
+
</tgroup>
215
+
</informaltable>
216
+
</refsect1>
217
+

196
218
<refsect1 role="examples">
197
219
&reftitle.examples;
198
220
<para>
...
...
@@ -228,34 +250,17 @@ imagedestroy($im);
228
250
</refsect1>
229
251
<refsect1 role="notes">
230
252
&reftitle.notes;
231
-
&note.gd.2;
232
253
&note.freetype;
233
254
</refsect1>
234
-
<refsect1 role="changelog">
235
-
&reftitle.changelog;
236
-
<para>
237
-
<informaltable>
238
-
<tgroup cols="2">
239
-
<thead>
240
-
<row>
241
-
<entry>&Version;</entry>
242
-
<entry>&Description;</entry>
243
-
</row>
244
-
</thead>
245
-
<tbody>
246
-
<row>
247
-
<entry>4.3.5</entry>
248
-
<entry>
249
-
<parameter>extrainfo</parameter> was made optional.
250
-
</entry>
251
-
</row>
252
-
</tbody>
253
-
</tgroup>
254
-
</informaltable>
255
-
</para>
255
+

256
+
<refsect1 role="seealso">
257
+
&reftitle.seealso;
258
+
<simplelist>
259
+
<member><function>imageftbbox</function></member>
260
+
<member><function>imagettftext</function></member>
261
+
</simplelist>
256
262
</refsect1>
257
263
</refentry>
258
-

259
264
<!-- Keep this comment at the end of the file
260
265
Local variables:
261
266
mode: sgml
262
267