<?php
include_once $_SERVER['DOCUMENT_ROOT'] . '/include/shared-manual.inc';
$TOC = array();
$TOC_DEPRECATED = array();
$PARENTS = array();
include_once dirname(__FILE__) ."/toc/ref.image.inc";
$setup = array (
  'home' => 
  array (
    0 => 'index.php',
    1 => 'PHP Manual',
  ),
  'head' => 
  array (
    0 => 'UTF-8',
    1 => 'fr',
  ),
  'this' => 
  array (
    0 => 'function.imageftbbox.php',
    1 => 'imageftbbox',
    2 => 'Calcule le rectangle d\'encadrement pour un texte, en utilisant la police courante et freetype2',
  ),
  'up' => 
  array (
    0 => 'ref.image.php',
    1 => 'Fonctions GD et images',
  ),
  'prev' => 
  array (
    0 => 'function.imagefontwidth.php',
    1 => 'imagefontwidth',
  ),
  'next' => 
  array (
    0 => 'function.imagefttext.php',
    1 => 'imagefttext',
  ),
  'alternatives' => 
  array (
  ),
  'source' => 
  array (
    'lang' => 'fr',
    'path' => 'reference/image/functions/imageftbbox.xml',
  ),
  'history' => 
  array (
  ),
);
$setup["toc"] = $TOC;
$setup["toc_deprecated"] = $TOC_DEPRECATED;
$setup["parents"] = $PARENTS;
manual_setup($setup);

contributors($setup);

?>
<div id="function.imageftbbox" class="refentry">
 <div class="refnamediv">
  <h1 class="refname">imageftbbox</h1>
  <p class="verinfo">(PHP 4 &gt;= 4.0.7, PHP 5, PHP 7, PHP 8)</p><p class="refpurpose"><span class="refname">imageftbbox</span> &mdash; <span class="dc-title">Calcule le rectangle d&#039;encadrement pour un texte, en utilisant la police courante et freetype2</span></p>

 </div>
 <div class="refsect1 description" id="refsect1-function.imageftbbox-description">
  <h3 class="title">Description</h3>
  <div class="methodsynopsis dc-description">
   <span class="methodname"><strong>imageftbbox</strong></span>(<br>&nbsp;&nbsp;&nbsp;&nbsp;<span class="methodparam"><span class="type"><a href="language.types.float.php" class="type float">float</a></span> <code class="parameter">$size</code></span>,<br>&nbsp;&nbsp;&nbsp;&nbsp;<span class="methodparam"><span class="type"><a href="language.types.float.php" class="type float">float</a></span> <code class="parameter">$angle</code></span>,<br>&nbsp;&nbsp;&nbsp;&nbsp;<span class="methodparam"><span class="type"><a href="language.types.string.php" class="type string">string</a></span> <code class="parameter">$font_filename</code></span>,<br>&nbsp;&nbsp;&nbsp;&nbsp;<span class="methodparam"><span class="type"><a href="language.types.string.php" class="type string">string</a></span> <code class="parameter">$string</code></span>,<br>&nbsp;&nbsp;&nbsp;&nbsp;<span class="methodparam"><span class="type"><a href="language.types.array.php" class="type array">array</a></span> <code class="parameter">$options</code><span class="initializer"> = []</span></span><br>): <span class="type"><span class="type"><a href="language.types.array.php" class="type array">array</a></span>|<span class="type"><a href="language.types.singleton.php" class="type false">false</a></span></span></div>

  <p class="para rdfs-comment">
   <span class="function"><strong>imageftbbox()</strong></span> calcule le rectangle d&#039;encadrement
   pour le texte <code class="parameter">text</code>, en utilisant la police
   courante et freetype2.
  </p>
  <blockquote class="note"><p><strong class="note">Note</strong>: 
   <p class="para">
    Antérieur à PHP 8.0.0, <span class="function"><strong>imageftbbox()</strong></span> était une variante
    étendue de <span class="function"><a href="function.imagettfbbox.php" class="function">imagettfbbox()</a></span> qui en plus supportait
    <code class="parameter">extrainfo</code>.
    À partir de PHP 8.0.0, <span class="function"><a href="function.imagettfbbox.php" class="function">imagettfbbox()</a></span> est un alias de
    <span class="function"><strong>imageftbbox()</strong></span>.
   </p>
  </p></blockquote>
 </div>

 <div class="refsect1 parameters" id="refsect1-function.imageftbbox-parameters">
  <h3 class="title">Liste de paramètres</h3>
  <p class="para">
   <dl>
    
     <dt><code class="parameter">size</code></dt>
     <dd>
      <p class="para">La taille de la police de caractères en point.</p>
     </dd>
    
    
     <dt><code class="parameter">angle</code></dt>
     <dd>
      <p class="para">
       Angle, en degrés, dans lequel le paramètre <code class="parameter">string</code>
       sera mesuré.
      </p>
     </dd>
    
    
     <dt><code class="parameter">font_filename</code></dt>
     <dd>
      <p class="para">
       Le nom du fichier de la police TrueType (peut être une URL).
       Suivant la version de GD utilisée par PHP, il sera recherché les
       fichiers qui ne commencent pas par un &#039;/&#039;, en y ajoutant l&#039;extension
       &#039;.ttf&#039;, et suivant le chemin des polices défini par la bibliothèque.
      </p>
     </dd>
    
    
     <dt><code class="parameter">string</code></dt>
     <dd>
      <p class="para">
       La chaîne à mesurer.
      </p>
     </dd>
    
    
     <dt><code class="parameter">options</code></dt>
     <dd>
      <p class="para">
       <table class="doctable table">
       <caption><strong>Index possibles pour le tableau <code class="parameter">options</code></strong></caption>
        
         <thead>
          <tr>
           <th>Clé</th>
           <th>Type</th>
           <th>Signification</th>
          </tr>

         </thead>

         <tbody class="tbody">
          <tr>
           <td><code class="literal">linespacing</code></td>
           <td><span class="type"><a href="language.types.float.php" class="type float">float</a></span></td>
           <td>Représente l&#039;espacement entre les lignes lors du dessin</td>
          </tr>

         </tbody>
        
       </table>

      </p>
     </dd>
    
   </dl>
  </p>
 </div>

 <div class="refsect1 returnvalues" id="refsect1-function.imageftbbox-returnvalues">
  <h3 class="title">Valeurs de retour</h3>
  <p class="para">
   <span class="function"><strong>imageftbbox()</strong></span> retourne un tableau contenant 8 éléments
   représentant les 4 points du rectangle entourant le texte :
   <table class="doctable informaltable">
    
     <tbody class="tbody">
      <tr>
       <td>0</td>
       <td>Coin en bas, à gauche, position en X</td>
      </tr>

      <tr>
       <td>1</td>
       <td>Coin en bas, à gauche, position en Y</td>
      </tr>

      <tr>
       <td>2</td>
       <td>Coin en bas, à droite, position en X</td>
      </tr>

      <tr>
       <td>3</td>
       <td>Coin en bas, à droite, position en Y</td>
      </tr>

      <tr>
       <td>4</td>
       <td>Coin en haut, à droite, position en X</td>
      </tr>

      <tr>
       <td>5</td>
       <td>Coin en haut, à droite, position en Y</td>
      </tr>

      <tr>
       <td>6</td>
       <td>Coin en haut, à gauche, position en X</td>
      </tr>

      <tr>
       <td>7</td>
       <td>Coin en haut, à gauche, position en Y</td>
      </tr>

     </tbody>
    
   </table>

  </p>
  <p class="para">
   Les points sont relatifs au <em>texte</em> suivant le paramètre
   <code class="parameter">angle</code>, aussi, &quot;en haut à gauche&quot; signifie le coin en
   haut à gauche lorsque l&#039;on regarde le texte horizontalement.
  </p>
  <p class="para">
   En cas d&#039;échec, <strong><code><a href="reserved.constants.php#constant.false">false</a></code></strong> est retourné.
  </p>
 </div>

 <div class="refsect1 examples" id="refsect1-function.imageftbbox-examples">
  <h3 class="title">Exemples</h3>
  <p class="para">
   <div class="example" id="example-1">
    <p><strong>Exemple #1 Exemple avec <span class="function"><strong>imageftbbox()</strong></span></strong></p>
    <div class="example-contents">
<div class="phpcode"><code><span style="color: #000000"><span style="color: #0000BB">&lt;?php<br /></span><span style="color: #FF8000">// Création d'une image de 300x150 pixels<br /></span><span style="color: #0000BB">$im </span><span style="color: #007700">= </span><span style="color: #0000BB">imagecreatetruecolor</span><span style="color: #007700">(</span><span style="color: #0000BB">300</span><span style="color: #007700">, </span><span style="color: #0000BB">150</span><span style="color: #007700">);<br /></span><span style="color: #0000BB">$black </span><span style="color: #007700">= </span><span style="color: #0000BB">imagecolorallocate</span><span style="color: #007700">(</span><span style="color: #0000BB">$im</span><span style="color: #007700">, </span><span style="color: #0000BB">0</span><span style="color: #007700">, </span><span style="color: #0000BB">0</span><span style="color: #007700">, </span><span style="color: #0000BB">0</span><span style="color: #007700">);<br /></span><span style="color: #0000BB">$white </span><span style="color: #007700">= </span><span style="color: #0000BB">imagecolorallocate</span><span style="color: #007700">(</span><span style="color: #0000BB">$im</span><span style="color: #007700">, </span><span style="color: #0000BB">255</span><span style="color: #007700">, </span><span style="color: #0000BB">255</span><span style="color: #007700">, </span><span style="color: #0000BB">255</span><span style="color: #007700">);<br /><br /></span><span style="color: #FF8000">// Définit l'arrière-plan en blanc<br /></span><span style="color: #0000BB">imagefilledrectangle</span><span style="color: #007700">(</span><span style="color: #0000BB">$im</span><span style="color: #007700">, </span><span style="color: #0000BB">0</span><span style="color: #007700">, </span><span style="color: #0000BB">0</span><span style="color: #007700">, </span><span style="color: #0000BB">299</span><span style="color: #007700">, </span><span style="color: #0000BB">299</span><span style="color: #007700">, </span><span style="color: #0000BB">$white</span><span style="color: #007700">);<br /><br /></span><span style="color: #FF8000">// Chemin vers notre fichier de police<br /></span><span style="color: #0000BB">$font </span><span style="color: #007700">= </span><span style="color: #DD0000">'./arial.ttf'</span><span style="color: #007700">;<br /><br /></span><span style="color: #FF8000">// D'abord, nous créons un rectangle contenant notre texte<br /></span><span style="color: #0000BB">$bbox </span><span style="color: #007700">= </span><span style="color: #0000BB">imageftbbox</span><span style="color: #007700">(</span><span style="color: #0000BB">10</span><span style="color: #007700">, </span><span style="color: #0000BB">0</span><span style="color: #007700">, </span><span style="color: #0000BB">$font</span><span style="color: #007700">, </span><span style="color: #DD0000">'The PHP Documentation Group'</span><span style="color: #007700">);<br /><br /></span><span style="color: #FF8000">// Nos coordonnées en X et en Y<br /></span><span style="color: #0000BB">$x </span><span style="color: #007700">= </span><span style="color: #0000BB">$bbox</span><span style="color: #007700">[</span><span style="color: #0000BB">0</span><span style="color: #007700">] + (</span><span style="color: #0000BB">imagesx</span><span style="color: #007700">(</span><span style="color: #0000BB">$im</span><span style="color: #007700">) / </span><span style="color: #0000BB">2</span><span style="color: #007700">) - (</span><span style="color: #0000BB">$bbox</span><span style="color: #007700">[</span><span style="color: #0000BB">4</span><span style="color: #007700">] / </span><span style="color: #0000BB">2</span><span style="color: #007700">) - </span><span style="color: #0000BB">5</span><span style="color: #007700">;<br /></span><span style="color: #0000BB">$y </span><span style="color: #007700">= </span><span style="color: #0000BB">$bbox</span><span style="color: #007700">[</span><span style="color: #0000BB">1</span><span style="color: #007700">] + (</span><span style="color: #0000BB">imagesy</span><span style="color: #007700">(</span><span style="color: #0000BB">$im</span><span style="color: #007700">) / </span><span style="color: #0000BB">2</span><span style="color: #007700">) - (</span><span style="color: #0000BB">$bbox</span><span style="color: #007700">[</span><span style="color: #0000BB">5</span><span style="color: #007700">] / </span><span style="color: #0000BB">2</span><span style="color: #007700">) - </span><span style="color: #0000BB">5</span><span style="color: #007700">;<br /><br /></span><span style="color: #0000BB">imagefttext</span><span style="color: #007700">(</span><span style="color: #0000BB">$im</span><span style="color: #007700">, </span><span style="color: #0000BB">10</span><span style="color: #007700">, </span><span style="color: #0000BB">0</span><span style="color: #007700">, </span><span style="color: #0000BB">$x</span><span style="color: #007700">, </span><span style="color: #0000BB">$y</span><span style="color: #007700">, </span><span style="color: #0000BB">$black</span><span style="color: #007700">, </span><span style="color: #0000BB">$font</span><span style="color: #007700">, </span><span style="color: #DD0000">'The PHP Documentation Group'</span><span style="color: #007700">);<br /><br /></span><span style="color: #FF8000">// Affichage vers le navigateur<br /></span><span style="color: #0000BB">header</span><span style="color: #007700">(</span><span style="color: #DD0000">'Content-Type: image/png'</span><span style="color: #007700">);<br /><br /></span><span style="color: #0000BB">imagepng</span><span style="color: #007700">(</span><span style="color: #0000BB">$im</span><span style="color: #007700">);<br /></span><span style="color: #0000BB">?&gt;</span></span></code></div>
    </div>

   </div>
  </p>
 </div>


 <div class="refsect1 notes" id="refsect1-function.imageftbbox-notes">
  <h3 class="title">Notes</h3>
  <blockquote class="note"><p><strong class="note">Note</strong>: <span class="simpara">Cette fonction n&#039;est disponible que si
    si PHP est compilé avec le support Freetype (<strong class="option configure">--with-freetype-dir=DIR</strong>)
</span></p></blockquote>
 </div>


 <div class="refsect1 seealso" id="refsect1-function.imageftbbox-seealso">
  <h3 class="title">Voir aussi</h3>
  <ul class="simplelist">
   <li><span class="function"><a href="function.imagefttext.php" class="function" rel="rdfs-seeAlso">imagefttext()</a> - &Eacute;crit du texte dans une image avec la police courante FreeType 2</span></li>
   <li><span class="function"><a href="function.imagettfbbox.php" class="function" rel="rdfs-seeAlso">imagettfbbox()</a> - Retourne le rectangle entourant un texte et dessin&eacute; avec une police TrueType</span></li>
  </ul>
 </div>

</div><?php manual_footer($setup); ?>