<?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 => 'pt_BR',
  ),
  'this' => 
  array (
    0 => 'function.imagefontwidth.php',
    1 => 'imagefontwidth',
    2 => 'Obt&eacute;m a largura da fonte',
  ),
  'up' => 
  array (
    0 => 'ref.image.php',
    1 => 'Fun&ccedil;&otilde;es de GD e Image',
  ),
  'prev' => 
  array (
    0 => 'function.imagefontheight.php',
    1 => 'imagefontheight',
  ),
  'next' => 
  array (
    0 => 'function.imageftbbox.php',
    1 => 'imageftbbox',
  ),
  'alternatives' => 
  array (
  ),
  'source' => 
  array (
    'lang' => 'pt_BR',
    'path' => 'reference/image/functions/imagefontwidth.xml',
  ),
  'history' => 
  array (
  ),
);
$setup["toc"] = $TOC;
$setup["toc_deprecated"] = $TOC_DEPRECATED;
$setup["parents"] = $PARENTS;
manual_setup($setup);

contributors($setup);

?>
<div id="function.imagefontwidth" class="refentry">
 <div class="refnamediv">
  <h1 class="refname">imagefontwidth</h1>
  <p class="verinfo">(PHP 4, PHP 5, PHP 7, PHP 8)</p><p class="refpurpose"><span class="refname">imagefontwidth</span> &mdash; <span class="dc-title">Obtém a largura da fonte</span></p>

 </div>
 <div class="refsect1 description" id="refsect1-function.imagefontwidth-description">
  <h3 class="title">Descrição</h3>
  <div class="methodsynopsis dc-description">
   <span class="methodname"><strong>imagefontwidth</strong></span>(<span class="methodparam"><span class="type"><span class="type"><a href="class.gdfont.php" class="type GdFont">GdFont</a></span>|<span class="type"><a href="language.types.integer.php" class="type int">int</a></span></span> <code class="parameter">$font</code></span>): <span class="type"><a href="language.types.integer.php" class="type int">int</a></span></div>

  <p class="para rdfs-comment">
   Retorna a largura da fonte, em pixels, de um caractere em determinada fonte.
  </p>
 </div>

 <div class="refsect1 parameters" id="refsect1-function.imagefontwidth-parameters">
  <h3 class="title">Parâmetros</h3>
  <p class="para">
   <dl>
    <dt>
<code class="parameter">font</code></dt><dd><p class="para">Pode ser 1, 2, 3, 4, 5 para as fontes
nativas na codificação latin2 (onde números maiores correspondem a fontes maiores) ou uma instância de <span class="classname"><a href="class.gdfont.php" class="classname">GdFont</a></span>,
retornada por <span class="function"><a href="function.imageloadfont.php" class="function">imageloadfont()</a></span>.</p></dd>
   </dl>
  </p>
 </div>

 <div class="refsect1 returnvalues" id="refsect1-function.imagefontwidth-returnvalues">
  <h3 class="title">Valor Retornado</h3>
  <p class="para">
   Retorna a largura da fonte em pixels.
  </p>
 </div>


 <div class="refsect1 changelog" id="refsect1-function.imagefontwidth-changelog">
  <h3 class="title">Registro de Alterações</h3>
  <p class="para">
   <table class="doctable informaltable">
    
     <thead>
      <tr>
       <th>Versão</th>
       <th>Descrição</th>
      </tr>

     </thead>

     <tbody class="tbody">
      <tr>
  <td>8.1.0</td>
  <td>
  O parâmetro <code class="parameter">font</code> agora aceita uma instância de <span class="classname"><a href="class.gdfont.php" class="classname">GdFont</a></span>
  ou um <span class="type"><a href="language.types.integer.php" class="type int">int</a></span>; anteriormente, apenas <span class="type"><a href="language.types.integer.php" class="type int">int</a></span> era aceito.
  </td>
</tr>

     </tbody>
    
   </table>

  </p>
 </div>


 <div class="refsect1 examples" id="refsect1-function.imagefontwidth-examples">
  <h3 class="title">Exemplos</h3>
  <p class="para">
   <div class="example" id="example-1">
    <p><strong>Exemplo #1 Usando <span class="function"><strong>imagefontwidth()</strong></span> em fontes internas</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: #007700">echo </span><span style="color: #DD0000">'Largura da fonte: ' </span><span style="color: #007700">. </span><span style="color: #0000BB">imagefontwidth</span><span style="color: #007700">(</span><span style="color: #0000BB">4</span><span style="color: #007700">);<br /></span><span style="color: #0000BB">?&gt;</span></span></code></div>
    </div>

    <div class="example-contents"><p>O exemplo acima produzirá
algo semelhante a:</p></div>
    <div class="example-contents screen">
<div class="examplescode"><pre class="examplescode">Largura da fonte: 8</pre>
</div>
    </div>
   </div>
   <div class="example" id="example-2">
    <p><strong>Exemplo #2 Usando <span class="function"><strong>imagefontwidth()</strong></span> junto com <span class="function"><a href="function.imageloadfont.php" class="function">imageloadfont()</a></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">// Carrega uma fonte .gdf<br /></span><span style="color: #0000BB">$font </span><span style="color: #007700">= </span><span style="color: #0000BB">imageloadfont</span><span style="color: #007700">(</span><span style="color: #DD0000">'anonymous.gdf'</span><span style="color: #007700">);<br /><br />echo </span><span style="color: #DD0000">'Largura da fonte: ' </span><span style="color: #007700">. </span><span style="color: #0000BB">imagefontwidth</span><span style="color: #007700">(</span><span style="color: #0000BB">$font</span><span style="color: #007700">);<br /></span><span style="color: #0000BB">?&gt;</span></span></code></div>
    </div>

    <div class="example-contents"><p>O exemplo acima produzirá
algo semelhante a:</p></div>
    <div class="example-contents screen">
<div class="examplescode"><pre class="examplescode">Largura da fonte: 23</pre>
</div>
    </div>
   </div>
  </p>
 </div>

 <div class="refsect1 seealso" id="refsect1-function.imagefontwidth-seealso">
  <h3 class="title">Veja Também</h3>
  <ul class="simplelist">
   <li><span class="function"><a href="function.imagefontheight.php" class="function" rel="rdfs-seeAlso">imagefontheight()</a> - Obt&eacute;m a altura da fonte</span></li>
   <li><span class="function"><a href="function.imageloadfont.php" class="function" rel="rdfs-seeAlso">imageloadfont()</a> - Carrega uma nova fonte</span></li>
  </ul>
 </div>

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