<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <HTML ><HEAD ><TITLE >ps_findfont</TITLE ><META NAME="GENERATOR" CONTENT="Modular DocBook HTML Stylesheet Version 1.79"><LINK REL="HOME" TITLE="PHP 手册" HREF="index.html"><LINK REL="UP" TITLE="PostScript document creation" HREF="ref.ps.html"><LINK REL="PREVIOUS" TITLE="ps_fill" HREF="function.ps-fill.html"><LINK REL="NEXT" TITLE="ps_get_buffer" HREF="function.ps-get-buffer.html"><META HTTP-EQUIV="Content-type" CONTENT="text/html; charset=UTF-8"></HEAD ><BODY CLASS="refentry" BGCOLOR="#FFFFFF" TEXT="#000000" LINK="#0000FF" VLINK="#840084" ALINK="#0000FF" ><DIV CLASS="NAVHEADER" ><TABLE SUMMARY="Header navigation table" WIDTH="100%" BORDER="0" CELLPADDING="0" CELLSPACING="0" ><TR ><TH COLSPAN="3" ALIGN="center" >PHP 手册</TH ></TR ><TR ><TD WIDTH="10%" ALIGN="left" VALIGN="bottom" ><A HREF="function.ps-fill.html" ACCESSKEY="P" >上一页</A ></TD ><TD WIDTH="80%" ALIGN="center" VALIGN="bottom" ></TD ><TD WIDTH="10%" ALIGN="right" VALIGN="bottom" ><A HREF="function.ps-get-buffer.html" ACCESSKEY="N" >下一页</A ></TD ></TR ></TABLE ><HR ALIGN="LEFT" WIDTH="100%"></DIV ><H1 ><A NAME="function.ps-findfont" ></A >ps_findfont</H1 ><DIV CLASS="refnamediv" ><A NAME="AEN191127" ></A ><P > (PECL)</P >ps_findfont -- Loads a font</DIV ><DIV CLASS="refsect1" ><A NAME="AEN191130" ></A ><H2 >说明</H2 >int <B CLASS="methodname" >ps_findfont</B > ( resource psdoc, string fontname, string encoding [, bool embed] )<BR ></BR ><P > Loads a font for later use. Before text is output with a loaded font it must be set with <A HREF="function.ps-setfont.html" ><B CLASS="function" >ps_setfont()</B ></A >. 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 <A HREF="function.ps-begin-page.html" ><B CLASS="function" >ps_begin_page()</B ></A >. Calling <B CLASS="function" >ps_findfont()</B > between pages will make that font available for all following pages. </P ><P > The name of the afm file must be <CODE CLASS="parameter" >fontname</CODE ><TT CLASS="literal" >.afm</TT >. If the font shall be embedded the file <CODE CLASS="parameter" >fontname</CODE ><TT CLASS="literal" >.pfb</TT > containing the font outline must be present as well. </P ><P > Calling <B CLASS="function" >ps_findfont()</B > 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 <A HREF="function.ps-begin-page.html" ><B CLASS="function" >ps_begin_page()</B ></A > which now comes after <B CLASS="function" >ps_findfont()</B >. Consequently the BoundingBox has not been set and a warning will be issued when <B CLASS="function" >ps_findfont()</B > is called. In order to prevent this situation, one should call <A HREF="function.ps-set-parameter.html" ><B CLASS="function" >ps_set_parameter()</B ></A > to set the BoundingBox before <B CLASS="function" >ps_findfont()</B > is called. </P ></DIV ><DIV CLASS="refsect1" ><A NAME="AEN191163" ></A ><H2 >参数</H2 ><P > <P ></P ><DIV CLASS="variablelist" ><DL ><DT ><CODE CLASS="parameter" >psdoc</CODE ></DT ><DD ><P > Resource identifier of the postscript file as returned by <A HREF="function.ps-new.html" ><B CLASS="function" >ps_new()</B ></A >. </P ></DD ><DT ><CODE CLASS="parameter" >fontname</CODE ></DT ><DD ><P > The name of the font. </P ></DD ><DT ><CODE CLASS="parameter" >encoding</CODE ></DT ><DD ><P > <B CLASS="function" >ps_findfont()</B > 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 <B CLASS="command" >dvips(1)</B >. 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 > <CODE CLASS="parameter" >encoding</CODE > can be <TT CLASS="constant" ><B >NULL</B ></TT > or the empty string if the default encoding (TeXBase1) shall be used. </P ><P > If the encoding is set to <TT CLASS="literal" >builtin</TT > 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 > 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 ></DL ></DIV > </P ></DIV ><DIV CLASS="refsect1" ><A NAME="AEN191196" ></A ><H2 >返回值</H2 ><P > Returns the identifier of the font or zero in case of an error. The identifier is a positive number. </P ></DIV ><DIV CLASS="refsect1" ><A NAME="AEN191199" ></A ><H2 >参见</H2 ><P > <P ></P ><TABLE BORDER="0" ><TBODY ><TR ><TD ><A HREF="function.ps-begin-page.html" ><B CLASS="function" >ps_begin_page()</B ></A ></TD ></TR ><TR ><TD ><A HREF="function.ps-setfont.html" ><B CLASS="function" >ps_setfont()</B ></A ></TD ></TR ></TBODY ></TABLE ><P ></P > </P ></DIV ><DIV CLASS="NAVFOOTER" ><HR ALIGN="LEFT" WIDTH="100%"><TABLE SUMMARY="Footer navigation table" WIDTH="100%" BORDER="0" CELLPADDING="0" CELLSPACING="0" ><TR ><TD WIDTH="33%" ALIGN="left" VALIGN="top" ><A HREF="function.ps-fill.html" ACCESSKEY="P" >上一页</A ></TD ><TD WIDTH="34%" ALIGN="center" VALIGN="top" ><A HREF="index.html" ACCESSKEY="H" >起始页</A ></TD ><TD WIDTH="33%" ALIGN="right" VALIGN="top" ><A HREF="function.ps-get-buffer.html" ACCESSKEY="N" >下一页</A ></TD ></TR ><TR ><TD WIDTH="33%" ALIGN="left" VALIGN="top" >ps_fill</TD ><TD WIDTH="34%" ALIGN="center" VALIGN="top" ><A HREF="ref.ps.html" ACCESSKEY="U" >上一级</A ></TD ><TD WIDTH="33%" ALIGN="right" VALIGN="top" >ps_get_buffer</TD ></TR ></TABLE ></DIV ></BODY ></HTML >