<?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 => 'es',
  ),
  'this' => 
  array (
    0 => 'function.imageftbbox.php',
    1 => 'imageftbbox',
    2 => 'Calcula el rect&aacute;ngulo de delimitaci&oacute;n para un texto, utilizando la fuente actual y freetype2',
  ),
  'up' => 
  array (
    0 => 'ref.image.php',
    1 => 'Funciones de GD e Im&aacute;genes',
  ),
  'prev' => 
  array (
    0 => 'function.imagefontwidth.php',
    1 => 'imagefontwidth',
  ),
  'next' => 
  array (
    0 => 'function.imagefttext.php',
    1 => 'imagefttext',
  ),
  'alternatives' => 
  array (
  ),
  'source' => 
  array (
    'lang' => 'es',
    '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">Calcula el rectángulo de delimitación para un texto, utilizando la fuente actual y freetype2</span></p>

 </div>
 <div class="refsect1 description" id="refsect1-function.imageftbbox-description">
  <h3 class="title">Descripción</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> calcula el rectángulo de delimitación
   para el texto <code class="parameter">text</code>, utilizando la fuente
   actual y freetype2.
  </p>
  <blockquote class="note"><p><strong class="note">Nota</strong>: 
   <p class="para">
    Anterior a PHP 8.0.0, <span class="function"><strong>imageftbbox()</strong></span> era una variante
    extendida de <span class="function"><a href="function.imagettfbbox.php" class="function">imagettfbbox()</a></span> que además soporta
    <code class="parameter">extrainfo</code>.
    A partir de PHP 8.0.0, <span class="function"><a href="function.imagettfbbox.php" class="function">imagettfbbox()</a></span> es 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">Parámetros</h3>
  <p class="para">
   <dl>
    
     <dt><code class="parameter">size</code></dt>
     <dd>
      <p class="para">El tamaño de la fuente en puntos.</p>
     </dd>
    
    
     <dt><code class="parameter">angle</code></dt>
     <dd>
      <p class="para">
       Ángulo, en grados, en el cual el parámetro <code class="parameter">string</code>
       será medido.
      </p>
     </dd>
    
    
     <dt><code class="parameter">font_filename</code></dt>
     <dd>
      <p class="para">
       El nombre del archivo de la fuente TrueType (puede ser una URL).
       Dependiendo de la versión de GD utilizada por PHP, se buscarán
       los archivos que no comiencen con un &#039;/&#039;, añadiendo la extensión
       &#039;.ttf&#039;, y siguiendo la ruta de fuentes definida por la biblioteca.
      </p>
     </dd>
    
    
     <dt><code class="parameter">string</code></dt>
     <dd>
      <p class="para">
       La cadena a medir.
      </p>
     </dd>
    
    
     <dt><code class="parameter">options</code></dt>
     <dd>
      <p class="para">
       <table class="doctable table">
       <caption><strong>Índices posibles para el array <code class="parameter">options</code></strong></caption>
        
         <thead>
          <tr>
           <th>Clave</th>
           <th>Tipo</th>
           <th>Significado</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>Representa el espaciado entre líneas al dibujar</td>
          </tr>

         </tbody>
        
       </table>

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

 <div class="refsect1 returnvalues" id="refsect1-function.imageftbbox-returnvalues">
  <h3 class="title">Valores devueltos</h3>
  <p class="para">
   <span class="function"><strong>imageftbbox()</strong></span> devuelve un array que contiene 8 elementos
   representando los 4 puntos del rectángulo que rodea el texto:
   <table class="doctable informaltable">
    
     <tbody class="tbody">
      <tr>
       <td>0</td>
       <td>Esquina inferior izquierda, posición en X</td>
      </tr>

      <tr>
       <td>1</td>
       <td>Esquina inferior izquierda, posición en Y</td>
      </tr>

      <tr>
       <td>2</td>
       <td>Esquina inferior derecha, posición en X</td>
      </tr>

      <tr>
       <td>3</td>
       <td>Esquina inferior derecha, posición en Y</td>
      </tr>

      <tr>
       <td>4</td>
       <td>Esquina superior derecha, posición en X</td>
      </tr>

      <tr>
       <td>5</td>
       <td>Esquina superior derecha, posición en Y</td>
      </tr>

      <tr>
       <td>6</td>
       <td>Esquina superior izquierda, posición en X</td>
      </tr>

      <tr>
       <td>7</td>
       <td>Esquina superior izquierda, posición en Y</td>
      </tr>

     </tbody>
    
   </table>

  </p>
  <p class="para">
   Los puntos son relativos al <em>texto</em> según el parámetro
   <code class="parameter">angle</code>, por lo que &quot;arriba a la izquierda&quot; significa la esquina en
   la parte superior izquierda cuando se mira el texto horizontalmente.
  </p>
  <p class="para">
   En caso de error, se devuelve <strong><code><a href="reserved.constants.php#constant.false">false</a></code></strong>.
  </p>
 </div>

 <div class="refsect1 examples" id="refsect1-function.imageftbbox-examples">
  <h3 class="title">Ejemplos</h3>
  <p class="para">
   <div class="example" id="example-1">
    <p><strong>Ejemplo #1 Ejemplo con <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">// Creación de una imagen de 300x150 píxeles<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">// Define el fondo en blanco<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">// Ruta hacia nuestro archivo de fuente<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">// Primero, creamos un rectángulo que contenga nuestro texto<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">// Nuestras coordenadas en X y 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">// Muestra hacia el navegador<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">Notas</h3>
  <blockquote class="note"><p><strong class="note">Nota</strong>: <span class="simpara">Esta función solo está disponible si
    si PHP es compilado con soporte 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">Ver también</h3>
  <ul class="simplelist">
   <li><span class="function"><a href="function.imagefttext.php" class="function" rel="rdfs-seeAlso">imagefttext()</a> - Escribe texto en una imagen con la fuente actual FreeType 2</span></li>
   <li><span class="function"><a href="function.imagettfbbox.php" class="function" rel="rdfs-seeAlso">imagettfbbox()</a> - Devuelve el rect&aacute;ngulo que rodea un texto dibujado con una fuente TrueType</span></li>
  </ul>
 </div>

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