<?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.imageloadfont.php',
    1 => 'imageloadfont',
    2 => '新しいフォントを読み込む',
  ),
  'up' => 
  array (
    0 => 'ref.image.php',
    1 => 'GD および Image 関数',
  ),
  'prev' => 
  array (
    0 => 'function.imageline.php',
    1 => 'imageline',
  ),
  'next' => 
  array (
    0 => 'function.imageopenpolygon.php',
    1 => 'imageopenpolygon',
  ),
  'alternatives' => 
  array (
  ),
  'source' => 
  array (
    'lang' => 'ja',
    'path' => 'reference/image/functions/imageloadfont.xml',
  ),
  'history' => 
  array (
  ),
);
$setup["toc"] = $TOC;
$setup["toc_deprecated"] = $TOC_DEPRECATED;
$setup["parents"] = $PARENTS;
manual_setup($setup);

contributors($setup);

?>
<div id="function.imageloadfont" class="refentry">
 <div class="refnamediv">
  <h1 class="refname">imageloadfont</h1>
  <p class="verinfo">(PHP 4, PHP 5, PHP 7, PHP 8)</p><p class="refpurpose"><span class="refname">imageloadfont</span> &mdash; <span class="dc-title">新しいフォントを読み込む</span></p>

 </div>
 <div class="refsect1 description" id="refsect1-function.imageloadfont-description">
  <h3 class="title">説明</h3>
  <div class="methodsynopsis dc-description">
   <span class="methodname"><strong>imageloadfont</strong></span>(<span class="methodparam"><span class="type"><a href="language.types.string.php" class="type string">string</a></span> <code class="parameter">$filename</code></span>): <span class="type"><span class="type"><a href="class.gdfont.php" class="type GdFont">GdFont</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>imageloadfont()</strong></span> はユーザーが定義したビットマップを読み込み、
   その ID を返します。
  </p>
 </div>

 <div class="refsect1 parameters" id="refsect1-function.imageloadfont-parameters">
  <h3 class="title">パラメータ</h3>
  <p class="para">
   <dl>
    
     <dt><code class="parameter">filename</code></dt>
     <dd>
      <p class="para">
       フォントファイル形式は現在はバイナリで、アーキクチャに依存します。
       このため、PHP を実行するマシーンと同一の型の CPU 上でフォントファイルを
       生成する必要があります。
      </p>
      <p class="para">
       <table class="doctable table">
        <caption><strong>フォントファイルのフォーマット</strong></caption>
        
         <thead>
         <tr>
          <th>バイト位置</th>
          <th>C 言語のデータ型</th>
          <th>説明</th>
         </tr>

         </thead>

         <tbody class="tbody">
          <tr>
           <td>0-3 バイト目</td>
           <td>int</td>
           <td>フォント中の文字の数</td>
          </tr>

          <tr>
           <td>4-7 バイト目</td>
           <td>int</td>
           <td>
            フォント中の最初の文字の値(しばしば 空白を表す 32 となります)
           </td>
          </tr>

          <tr>
           <td>8-11 バイト目</td>
           <td>int</td>
           <td>各文字のピクセル幅</td>
          </tr>

          <tr>
           <td>12-15 バイト目</td>
           <td>int</td>
           <td>各文字のピクセル高さ</td>
          </tr>

          <tr>
           <td>16 バイト目から</td>
           <td>char</td>
           <td>
            文字データの配列、各文字のピクセルにつき1バイトで、
            総数は(文字数*幅*高さ)バイトです。
           </td>
          </tr>

         </tbody>
        
       </table>

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

 <div class="refsect1 returnvalues" id="refsect1-function.imageloadfont-returnvalues">
  <h3 class="title">戻り値</h3>
  <p class="para">
   <span class="classname"><a href="class.gdfont.php" class="classname">GdFont</a></span> クラスのインスタンスを返します。
   失敗した場合に <strong><code><a href="reserved.constants.php#constant.false">false</a></code></strong> を返します
  </p>
 </div>


 <div class="refsect1 changelog" id="refsect1-function.imageloadfont-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>
        <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.imageloadfont-examples">
  <h3 class="title">例</h3>
  <p class="para">
   <div class="example" id="example-1">
    <p><strong>例1 <span class="function"><strong>imageloadfont()</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">// 新しい画像インスタンスを作成します<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">50</span><span style="color: #007700">, </span><span style="color: #0000BB">20</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">// 背景を白に設定します<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">49</span><span style="color: #007700">, </span><span style="color: #0000BB">19</span><span style="color: #007700">, </span><span style="color: #0000BB">$white</span><span style="color: #007700">);<br /><br /></span><span style="color: #FF8000">// gd フォントを読み込み 'Hello' を書き込みます<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">'./04b.gdf'</span><span style="color: #007700">);<br /></span><span style="color: #0000BB">imagestring</span><span style="color: #007700">(</span><span style="color: #0000BB">$im</span><span style="color: #007700">, </span><span style="color: #0000BB">$font</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: #DD0000">'Hello'</span><span style="color: #007700">, </span><span style="color: #0000BB">$black</span><span style="color: #007700">);<br /><br /></span><span style="color: #FF8000">// ブラウザに出力します<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 seealso" id="refsect1-function.imageloadfont-seealso">
  <h3 class="title">参考</h3>
  <ul class="simplelist">
   <li><span class="function"><a href="function.imagefontwidth.php" class="function" rel="rdfs-seeAlso">imagefontwidth()</a> - フォントの幅を取得する</span></li>
   <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.imagestring.php" class="function" rel="rdfs-seeAlso">imagestring()</a> - 文字列を水平に描画する</span></li>
  </ul>
 </div>

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