SetFont(string family [, string style [, float size]])
DescriptionSets 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.
The font can be either a standard one or a font added via the AddFont() method. Standard fonts use the Windows encoding cp1252 (Western Europe).
The method can be called before the first page is created and the font is kept from page to page.
If you just wish to change the current font size, it is simpler to call SetFontSize().
Note: the font definition files must be accessible. They are searched successively in:
- The directory defined by the
FPDF_FONTPATHconstant (if this constant is defined)
fontdirectory located in the same directory as
fpdf.php(if it exists)
- The directories accessible through
Family font. It can be either a name defined by AddFont() or one of the standard families (case
Arial(synonymous; sans serif)
Font style. Possible values are (case insensitive):
- empty string: regular
Font size in points.
The default value is the current size. If no size has been specified since the beginning of the document, the value taken is 12.
// Times regular 12 $pdf->SetFont('Times'); // Arial bold 14 $pdf->SetFont('Arial','B',14); // Removes bold $pdf->SetFont(''); // Times bold, italic and underlined 14 $pdf->SetFont('Times','BIU');