<?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 => 'ja',
  ),
  'this' => 
  array (
    0 => 'function.imagefontwidth.php',
    1 => 'imagefontwidth',
    2 => 'フォントの幅を取得する',
  ),
  'up' => 
  array (
    0 => 'ref.image.php',
    1 => 'GD および Image 関数',
  ),
  'prev' => 
  array (
    0 => 'function.imagefontheight.php',
    1 => 'imagefontheight',
  ),
  'next' => 
  array (
    0 => 'function.imageftbbox.php',
    1 => 'imageftbbox',
  ),
  'alternatives' => 
  array (
  ),
  'source' => 
  array (
    'lang' => 'ja',
    '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">フォントの幅を取得する</span></p>

 </div>
 <div class="refsect1 description" id="refsect1-function.imagefontwidth-description">
  <h3 class="title">説明</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">
   指定されたフォントの文字の幅をピクセル単位で返します。
  </p>
 </div>

 <div class="refsect1 parameters" id="refsect1-function.imagefontwidth-parameters">
  <h3 class="title">パラメータ</h3>
  <p class="para">
   <dl>
    <dt><code class="parameter">font</code></dt><dd><p class="para">latin2 エンコーディングの組み込みのフォントの場合は 1, 2, 3, 4, 5 のいずれか (数字が大きなほうが、より大きいフォントに対応します)、あるいは <span class="function"><a href="function.imageloadfont.php" class="function">imageloadfont()</a></span> が返した、<span class="classname"><a href="class.gdfont.php" class="classname">GdFont</a></span> クラスのインスタンスのいずれか。</p></dd>
   </dl>
  </p>
 </div>

 <div class="refsect1 returnvalues" id="refsect1-function.imagefontwidth-returnvalues">
  <h3 class="title">戻り値</h3>
  <p class="para">
   フォントの幅をピクセルで返します。
  </p>
 </div>


 <div class="refsect1 changelog" id="refsect1-function.imagefontwidth-changelog">
 <h3 class="title">変更履歴</h3>
 <p class="para">
  <table class="doctable informaltable">
   
    <thead>
     <tr>
      <th>バージョン</th>
      <th>説明</th>
     </tr>

    </thead>

    <tbody class="tbody">
     <tr>
  <td>8.1.0</td>
  <td>
  引数 <code class="parameter">font</code> は、<span class="classname"><a href="class.gdfont.php" class="classname">GdFont</a></span> クラスのインスタンスと数値を両方受け入れるようになりました。これより前のバージョンでは、数値のみを受け入れていました。
  </td>
</tr>

    </tbody>
   
  </table>

 </p>
</div>

 
 <div class="refsect1 examples" id="refsect1-function.imagefontwidth-examples">
  <h3 class="title">例</h3>
  <p class="para">
   <div class="example" id="example-1">
    <p><strong>例1 組み込みフォントでの <span class="function"><strong>imagefontwidth()</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: #007700">echo </span><span style="color: #DD0000">'フォントの幅: ' </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>上の例の出力は、
たとえば以下のようになります。</p></div>
    <div class="example-contents screen">
<div class="examplescode"><pre class="examplescode">フォントの幅: 8</pre>
</div>
    </div>
   </div>
   <div class="example" id="example-2">
    <p><strong>例2 <span class="function"><strong>imagefontwidth()</strong></span> と <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">// .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">'フォントの幅: ' </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>上の例の出力は、
たとえば以下のようになります。</p></div>
    <div class="example-contents screen">
<div class="examplescode"><pre class="examplescode">フォントの幅: 23</pre>
</div>
    </div>
   </div>
  </p>
 </div>

 <div class="refsect1 seealso" id="refsect1-function.imagefontwidth-seealso">
  <h3 class="title">参考</h3>
  <ul class="simplelist">
   <li><span class="function"><a href="function.imagefontheight.php" class="function" rel="rdfs-seeAlso">imagefontheight()</a> - フォントの高さを取得する</span></li>
   <li><span class="function"><a href="function.imageloadfont.php" class="function" rel="rdfs-seeAlso">imageloadfont()</a> - 新しいフォントを読み込む</span></li>
  </ul>
 </div>

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