1
0
mirror of https://github.com/php/doc-ru.git synced 2026-03-26 08:42:13 +01:00
Files
archived-doc-ru/reference/image/functions/imageloadfont.xml
Sergey Panteleev 6d43fd64d7 Исправление форматирования
[skip-spellcheck]
[skip-lint]
2022-12-27 03:42:36 +03:00

178 lines
5.4 KiB
XML
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
<?xml version="1.0" encoding="utf-8"?>
<!-- EN-Revision: a7e5e563d2d2269a6d7ccff506715a3e1a6f3902 Maintainer: tmn Status: ready -->
<!-- Reviewed: no -->
<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> загружает определённый пользователем шрифт
и возвращает его идентификатор.
</para>
</refsect1>
<refsect1 role="parameters">
&reftitle.parameters;
<para>
<variablelist>
<varlistentry>
<term><parameter>filename</parameter></term>
<listitem>
<para>
Формат файла шрифта двоичный и зависит от архитектуры системы. Это означает
необходимость генерировать файл шрифта на том же процессоре, на котором
работает PHP.
</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>
массив с данными символов, один байт на пиксел в каждом символе.
Для всех кол-во*высота*ширина байт.
</entry>
</row>
</tbody>
</tgroup>
</table>
</para>
</listitem>
</varlistentry>
</variablelist>
</para>
</refsect1>
<refsect1 role="returnvalues">
&reftitle.returnvalues;
<para>
Возвращает экземпляр <classname>GdFont</classname>&return.falseforfailure;.
Идентификатор шрифта, который всегда больше 5 для предотвращения конфликтов со
встроенными шрифтами, либо &false; в случае возникновения ошибки.
</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>;
ранее возвращалось целое число (&integer;).
</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 шрифта и надпись 'Привет'
$font = imageloadfont('./04b.gdf');
imagestring($im, $font, 0, 0, 'Привет', $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
-->