uTools-Manuals/docs/php/ps_findfont.html
2019-04-28 19:00:34 +08:00

150 lines
6.0 KiB
HTML

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<title>Loads a font</title>
</head>
<body class="docs"><div id="layout">
<div id="layout-content"><div id="function.ps-findfont" class="refentry">
<div class="refnamediv">
<h1 class="refname">ps_findfont</h1>
<p class="verinfo">(PECL ps &gt;= 1.1.0)</p><p class="refpurpose"><span class="refname">ps_findfont</span> &mdash; <span class="dc-title">Loads a font</span></p>
</div>
<div class="refsect1 description" id="refsect1-function.ps-findfont-description">
<h3 class="title">说明</h3>
<div class="methodsynopsis dc-description">
<span class="methodname"><strong>ps_findfont</strong></span>
( <span class="methodparam"><span class="type">resource</span> <code class="parameter">$psdoc</code></span>
, <span class="methodparam"><span class="type">string</span> <code class="parameter">$fontname</code></span>
, <span class="methodparam"><span class="type">string</span> <code class="parameter">$encoding</code></span>
[, <span class="methodparam"><span class="type">bool</span> <code class="parameter">$embed</code><span class="initializer"> = <strong><code>FALSE</code></strong></span></span>
] ) : <span class="type">int</span></div>
<p class="para rdfs-comment">
Loads a font for later use. Before text is output with a loaded font it
must be set with <span class="function"><a href="ps_setfont.html" class="function">ps_setfont()</a></span>. This function needs the
adobe font metric file in order to calculate the space used up by the
characters. A font which is loaded within a page will only be available on
that page. Fonts which are to be used in the complete document have to be
loaded before the first call of <span class="function"><a href="ps_begin_page.html" class="function">ps_begin_page()</a></span>. Calling
<span class="function"><strong>ps_findfont()</strong></span> between pages will make that font
available for all following pages.
</p>
<p class="para">
The name of the afm file must be
<code class="parameter">fontname</code><em>.afm</em>. If the font
shall be embedded the file
<code class="parameter">fontname</code><em>.pfb</em> containing
the font outline must be present as well.
</p>
<p class="para">
Calling <span class="function"><strong>ps_findfont()</strong></span> before the first page requires
to output the postscript header which includes the BoundingBox for
the whole document. Usually the BoundingBox is set with the first call
of <span class="function"><a href="ps_begin_page.html" class="function">ps_begin_page()</a></span> which now comes after
<span class="function"><strong>ps_findfont()</strong></span>. Consequently the BoundingBox has not
been set and a warning will be issued when <span class="function"><strong>ps_findfont()</strong></span>
is called. In order to prevent this situation, one should call
<span class="function"><a href="ps_set_parameter.html" class="function">ps_set_parameter()</a></span> to set the BoundingBox before
<span class="function"><strong>ps_findfont()</strong></span> is called.
</p>
</div>
<div class="refsect1 parameters" id="refsect1-function.ps-findfont-parameters">
<h3 class="title">参数</h3>
<p class="para">
<dl>
<dt>
<code class="parameter">psdoc</code></dt>
<dd>
<p class="para">
Resource identifier of the postscript file
as returned by <span class="function"><a href="ps_new.html" class="function">ps_new()</a></span>.
</p>
</dd>
<dt>
<code class="parameter">fontname</code></dt>
<dd>
<p class="para">
The name of the font.
</p>
</dd>
<dt>
<code class="parameter">encoding</code></dt>
<dd>
<p class="para">
<span class="function"><strong>ps_findfont()</strong></span> will try to load the file passed in
the parameter <code class="parameter">encoding</code>. Encoding files are of
the same syntax as those used by <strong class="command">dvips(1)</strong>. They
contain a font encoding vector (which is currently not used but must be
present) and a list of extra ligatures to extend the list of ligatures
derived from the afm file.
</p>
<p class="para">
<code class="parameter">encoding</code> can be <strong><code>NULL</code></strong> or the empty string if
the default encoding (TeXBase1) shall be used.
</p>
<p class="para">
If the encoding is set to <em>builtin</em> then there
will be no reencoding and the font specific encoding will be used. This
is very useful with symbol fonts.
</p>
</dd>
<dt>
<code class="parameter">embed</code></dt>
<dd>
<p class="para">
If set to a value &gt;0 the font will be embedded into the document. This
requires the font outline (.pfb file) to be present.
</p>
</dd>
</dl>
</p>
</div>
<div class="refsect1 returnvalues" id="refsect1-function.ps-findfont-returnvalues">
<h3 class="title">返回值</h3>
<p class="para">
Returns the identifier of the font or zero in case of an error. The
identifier is a positive number.
</p>
</div>
<div class="refsect1 seealso" id="refsect1-function.ps-findfont-seealso">
<h3 class="title">参见</h3>
<p class="para">
<ul class="simplelist">
<li class="member"><span class="function"><a href="ps_begin_page.html" class="function" rel="rdfs-seeAlso">ps_begin_page()</a> - Start a new page</span></li>
<li class="member"><span class="function"><a href="ps_setfont.html" class="function" rel="rdfs-seeAlso">ps_setfont()</a> - Sets font to use for following output</span></li>
</ul>
</p>
</div>
</div></div></div></body></html>