mirror of
https://github.com/php/doc-ja.git
synced 2026-04-28 10:33:19 +02:00
176 lines
4.9 KiB
XML
176 lines
4.9 KiB
XML
<?xml version="1.0" encoding="utf-8"?>
|
|
<!-- $Revision$ -->
|
|
<!-- EN-Revision: a7e5e563d2d2269a6d7ccff506715a3e1a6f3902 Maintainer: hirokawa Status: ready -->
|
|
<!-- CREDITS: shimooka,mumumu -->
|
|
<refentry xml:id="function.imageloadfont" xmlns="http://docbook.org/ns/docbook">
|
|
<refnamediv>
|
|
<refname>imageloadfont</refname>
|
|
<refpurpose>新しいフォントを読み込む</refpurpose>
|
|
</refnamediv>
|
|
<refsect1 role="description">
|
|
&reftitle.description;
|
|
<methodsynopsis>
|
|
<type class="union"><type>GdFont</type><type>false</type></type><methodname>imageloadfont</methodname>
|
|
<methodparam><type>string</type><parameter>filename</parameter></methodparam>
|
|
</methodsynopsis>
|
|
<para>
|
|
<function>imageloadfont</function> はユーザーが定義したビットマップを読み込み、
|
|
その ID を返します。
|
|
</para>
|
|
</refsect1>
|
|
<refsect1 role="parameters">
|
|
&reftitle.parameters;
|
|
<para>
|
|
<variablelist>
|
|
<varlistentry>
|
|
<term><parameter>filename</parameter></term>
|
|
<listitem>
|
|
<para>
|
|
フォントファイル形式は現在はバイナリで、アーキクチャに依存します。
|
|
このため、PHP を実行するマシーンと同一の型の CPU 上でフォントファイルを
|
|
生成する必要があります。
|
|
</para>
|
|
<para>
|
|
<table>
|
|
<title>フォントファイルのフォーマット</title>
|
|
<tgroup cols="3">
|
|
<thead>
|
|
<row>
|
|
<entry>バイト位置</entry>
|
|
<entry>C 言語のデータ型</entry>
|
|
<entry>説明</entry>
|
|
</row>
|
|
</thead>
|
|
<tbody>
|
|
<row>
|
|
<entry>0-3 バイト目</entry>
|
|
<entry>int</entry>
|
|
<entry>フォント中の文字の数</entry>
|
|
</row>
|
|
<row>
|
|
<entry>4-7 バイト目</entry>
|
|
<entry>int</entry>
|
|
<entry>
|
|
フォント中の最初の文字の値(しばしば 空白を表す 32 となります)
|
|
</entry>
|
|
</row>
|
|
<row>
|
|
<entry>8-11 バイト目</entry>
|
|
<entry>int</entry>
|
|
<entry>各文字のピクセル幅</entry>
|
|
</row>
|
|
<row>
|
|
<entry>12-15 バイト目</entry>
|
|
<entry>int</entry>
|
|
<entry>各文字のピクセル高さ</entry>
|
|
</row>
|
|
<row>
|
|
<entry>16 バイト目から</entry>
|
|
<entry>char</entry>
|
|
<entry>
|
|
文字データの配列、各文字のピクセルにつき1バイトで、
|
|
総数は(文字数*幅*高さ)バイトです。
|
|
</entry>
|
|
</row>
|
|
</tbody>
|
|
</tgroup>
|
|
</table>
|
|
</para>
|
|
</listitem>
|
|
</varlistentry>
|
|
</variablelist>
|
|
</para>
|
|
</refsect1>
|
|
<refsect1 role="returnvalues">
|
|
&reftitle.returnvalues;
|
|
<para>
|
|
<classname>GdFont</classname> クラスのインスタンスを返します。
|
|
&return.falseforfailure;
|
|
</para>
|
|
</refsect1>
|
|
|
|
<refsect1 role="changelog">
|
|
&reftitle.changelog;
|
|
<para>
|
|
<informaltable>
|
|
<tgroup cols="2">
|
|
<thead>
|
|
<row>
|
|
<entry>&Version;</entry>
|
|
<entry>&Description;</entry>
|
|
</row>
|
|
</thead>
|
|
<tbody>
|
|
<row>
|
|
<entry>8.1.0</entry>
|
|
<entry>
|
|
<classname>GdFont</classname> クラスのインスタンスを返すようになりました。
|
|
これより前のバージョンでは、数値を返していました。
|
|
</entry>
|
|
</row>
|
|
</tbody>
|
|
</tgroup>
|
|
</informaltable>
|
|
</para>
|
|
</refsect1>
|
|
|
|
<refsect1 role="examples">
|
|
&reftitle.examples;
|
|
<para>
|
|
<example>
|
|
<title><function>imageloadfont</function> の使用例</title>
|
|
<programlisting role="php">
|
|
<![CDATA[
|
|
<?php
|
|
// 新しい画像インスタンスを作成します
|
|
$im = imagecreatetruecolor(50, 20);
|
|
$black = imagecolorallocate($im, 0, 0, 0);
|
|
$white = imagecolorallocate($im, 255, 255, 255);
|
|
|
|
// 背景を白に設定します
|
|
imagefilledrectangle($im, 0, 0, 49, 19, $white);
|
|
|
|
// gd フォントを読み込み 'Hello' を書き込みます
|
|
$font = imageloadfont('./04b.gdf');
|
|
imagestring($im, $font, 0, 0, 'Hello', $black);
|
|
|
|
// ブラウザに出力します
|
|
header('Content-type: image/png');
|
|
|
|
imagepng($im);
|
|
imagedestroy($im);
|
|
?>
|
|
]]>
|
|
</programlisting>
|
|
</example>
|
|
</para>
|
|
</refsect1>
|
|
<refsect1 role="seealso">
|
|
&reftitle.seealso;
|
|
<simplelist>
|
|
<member><function>imagefontwidth</function></member>
|
|
<member><function>imagefontheight</function></member>
|
|
</simplelist>
|
|
</refsect1>
|
|
</refentry>
|
|
<!-- Keep this comment at the end of the file
|
|
Local variables:
|
|
mode: sgml
|
|
sgml-omittag:t
|
|
sgml-shorttag:t
|
|
sgml-minimize-attributes:nil
|
|
sgml-always-quote-attributes:t
|
|
sgml-indent-step:1
|
|
sgml-indent-data:t
|
|
indent-tabs-mode:nil
|
|
sgml-parent-document:nil
|
|
sgml-default-dtd-file:"~/.phpdoc/manual.ced"
|
|
sgml-exposed-tags:nil
|
|
sgml-local-catalogs:nil
|
|
sgml-local-ecat-files:nil
|
|
End:
|
|
vim600: syn=xml fen fdm=syntax fdl=2 si
|
|
vim: et tw=78 syn=sgml
|
|
vi: ts=1 sw=1
|
|
-->
|