99 lines
		
	
	
		
			3.3 KiB
		
	
	
	
		
			HTML
		
	
	
		
			Executable File
		
	
	
	
	
			
		
		
	
	
			99 lines
		
	
	
		
			3.3 KiB
		
	
	
	
		
			HTML
		
	
	
		
			Executable File
		
	
	
	
	
| <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
 | |
| <HTML>
 | |
| <HEAD>
 | |
| <META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=ISO-8859-1">
 | |
| <TITLE>SetFont</TITLE>
 | |
| <LINK TYPE="text/css" REL="stylesheet" HREF="../fpdf.css">
 | |
| </HEAD>
 | |
| <BODY>
 | |
| <H2>SetFont</H2>
 | |
| <TT>SetFont(<B>string</B> family [, <B>string</B> style [, <B>float</B> size]])</TT>
 | |
| <H4 CLASS='st'>Version</H4>
 | |
| 1.0
 | |
| <H4 CLASS='st'>Description</H4>
 | |
| Sets the font used to print character strings. It is mandatory to call this method
 | |
| at least once before printing text or the resulting document would not be valid.
 | |
| <BR>
 | |
| The font can be either a standard one or a font added via the AddFont() method. Standard fonts
 | |
| use Windows encoding cp1252 (Western Europe).
 | |
| <BR>
 | |
| The method can be called before the first page is created and the font is retained from page
 | |
| to page.
 | |
| <BR>
 | |
| If you just wish to change the current font size, it is simpler to call SetFontSize().
 | |
| <BR>
 | |
| <BR>
 | |
| <B>Note:</B> the font metric files must be accessible. They are searched successively in:
 | |
| <UL>
 | |
| <LI>The directory defined by the <TT>FPDF_FONTPATH</TT> constant (if this constant is defined)
 | |
| <LI>The <TT>font</TT> directory located in the directory containing <TT>fpdf.php</TT> (if it exists)
 | |
| <LI>The directories accessible through <TT>include()</TT>
 | |
| </UL>
 | |
| Example defining <TT>FPDF_FONTPATH</TT> (note the mandatory trailing slash):
 | |
| <BR>
 | |
| <BR>
 | |
| <TABLE WIDTH="100%" BGCOLOR="#E0E0E0"><TR><TD>
 | |
| <TT>
 | |
| define('FPDF_FONTPATH','/home/www/font/');<BR>
 | |
| require('fpdf.php');
 | |
| </TT>
 | |
| </TD></TR></TABLE><BR>
 | |
| If the file corresponding to the requested font is not found, the error "Could not include
 | |
| font metric file" is issued.
 | |
| <H4 CLASS='st'>Parameters</H4>
 | |
| <TT><U>family</U></TT>
 | |
| <BLOCKQUOTE>
 | |
| Family font. It can be either a name defined by AddFont() or one of the standard families (case
 | |
| insensitive):
 | |
| <UL>
 | |
| <LI><TT>Courier</TT> (fixed-width)
 | |
| <LI><TT>Helvetica</TT> or <TT>Arial</TT> (synonymous; sans serif)
 | |
| <LI><TT>Times</TT> (serif)
 | |
| <LI><TT>Symbol</TT> (symbolic)
 | |
| <LI><TT>ZapfDingbats</TT> (symbolic)
 | |
| </UL>
 | |
| It is also possible to pass an empty string. In that case, the current family is retained.
 | |
| </BLOCKQUOTE>
 | |
| <TT><U>style</U></TT>
 | |
| <BLOCKQUOTE>
 | |
| Font style. Possible values are (case insensitive):
 | |
| <UL>
 | |
| <LI>empty string: regular
 | |
| <LI><TT>B</TT>: bold
 | |
| <LI><TT>I</TT>: italic
 | |
| <LI><TT>U</TT>: underline
 | |
| </UL>
 | |
| or any combination. The default value is regular.
 | |
| Bold and italic styles do not apply to <TT>Symbol</TT> and <TT>ZapfDingbats</TT>.
 | |
| </BLOCKQUOTE>
 | |
| <TT><U>size</U></TT>
 | |
| <BLOCKQUOTE>
 | |
| Font size in points.
 | |
| <BR>
 | |
| The default value is the current size. If no size has been specified since the beginning of
 | |
| the document, the value taken is 12.
 | |
| </BLOCKQUOTE>
 | |
| <H4 CLASS='st'>Example</H4>
 | |
| <TABLE WIDTH="100%" BGCOLOR="#E0E0E0"><TR><TD>
 | |
| <TT>
 | |
| //Times regular 12<BR>
 | |
| $pdf->SetFont('Times');<BR>
 | |
| //Arial bold 14<BR>
 | |
| $pdf->SetFont('Arial','B',14);<BR>
 | |
| //Removes bold<BR>
 | |
| $pdf->SetFont('');<BR>
 | |
| //Times bold, italic and underlined 14<BR>
 | |
| $pdf->SetFont('Times','BIU');
 | |
| </TT>
 | |
| </TD></TR></TABLE><BR>
 | |
| <H4 CLASS='st'>See also</H4>
 | |
| <A HREF="addfont.htm">AddFont()</A>,
 | |
| <A HREF="setfontsize.htm">SetFontSize()</A>,
 | |
| <A HREF="cell.htm">Cell()</A>,
 | |
| <A HREF="multicell.htm">MultiCell()</A>,
 | |
| <A HREF="write.htm">Write()</A>.
 | |
| <HR STYLE="margin-top:1.2em">
 | |
| <DIV ALIGN="CENTER"><A HREF="index.htm">Index</A></DIV>
 | |
| </BODY>
 | |
| </HTML>
 |