<!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><div class="manualnavbar" style="text-align: center;"> <div class="prev" style="text-align: left; float: left;"><a href="function.ps-fill.html">ps_fill</a></div> <div class="next" style="text-align: right; float: right;"><a href="function.ps-get-buffer.html">ps_get_buffer</a></div> <div class="up"><a href="ref.ps.html">PS Functions</a></div> <div class="home"><a href="index.html">PHP Manual</a></div> </div><hr /><div id="function.ps-findfont" class="refentry"> <div class="refnamediv"> <h1 class="refname">ps_findfont</h1> <p class="verinfo">(PECL ps >= 1.1.0)</p><p class="refpurpose"><span class="refname">ps_findfont</span> — <span class="dc-title">Loads a font</span></p> </div> <div class="refsect1 description" id="refsect1-function.ps-findfont-description"> <h3 class="title">Description</h3> <div class="methodsynopsis dc-description"> <span class="type">int</span> <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"> = false</span></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="function.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="function.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 <em><code class="parameter">fontname</code></em><em>.afm</em>. If the font shall be embedded the file <em><code class="parameter">fontname</code></em><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="function.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="function.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">Parameters</h3> <p class="para"> <dl> <dt> <span class="term"><em><code class="parameter">psdoc</code></em></span> <dd> <p class="para"> Resource identifier of the postscript file as returned by <span class="function"><a href="function.ps-new.html" class="function">ps_new()</a></span>. </p> </dd> </dt> <dt> <span class="term"><em><code class="parameter">fontname</code></em></span> <dd> <p class="para"> The name of the font. </p> </dd> </dt> <dt> <span class="term"><em><code class="parameter">encoding</code></em></span> <dd> <p class="para"> <span class="function"><strong>ps_findfont()</strong></span> will try to load the file passed in the parameter <em><code class="parameter">encoding</code></em>. 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"> <em><code class="parameter">encoding</code></em> 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> <dt> <span class="term"><em><code class="parameter">embed</code></em></span> <dd> <p class="para"> If set to a value >0 the font will be embedded into the document. This requires the font outline (.pfb file) to be present. </p> </dd> </dt> </dl> </p> </div> <div class="refsect1 returnvalues" id="refsect1-function.ps-findfont-returnvalues"> <h3 class="title">Return Values</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">See Also</h3> <p class="para"> <ul class="simplelist"> <li class="member"> <span class="function"><a href="function.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="function.ps-setfont.html" class="function" rel="rdfs-seeAlso">ps_setfont()</a> - Sets font to use for following output</span></li> </ul> </p> </div> </div><hr /><div class="manualnavbar" style="text-align: center;"> <div class="prev" style="text-align: left; float: left;"><a href="function.ps-fill.html">ps_fill</a></div> <div class="next" style="text-align: right; float: right;"><a href="function.ps-get-buffer.html">ps_get_buffer</a></div> <div class="up"><a href="ref.ps.html">PS Functions</a></div> <div class="home"><a href="index.html">PHP Manual</a></div> </div></body></html>