SetFont(**string** family [, **string** style [, **float** size]])
Sets the font used to print character strings. It is mandatory to call this method at least once before printing text.
The font can be either a standard one or a font added using the AddFont() method. Standard fonts use Windows cp1252 encoding (Western Europe).
The method can be called before creating the first page and the font is maintained from page to page.
If you just want to change the size of the current font, it's simpler to call SetFontSize().
family
Font family. It can be either a name defined by AddFont() or one of the standard families (case insensitive):
Courier
(fixed-width)Helvetica
or Arial
(synonyms; sans serif)Times
(serif)Symbol
(symbolic)ZapfDingbats
(symbolic)It is also possible to pass an empty string. In that case, the current family is retained.
style
Font style. Possible values are (case insensitive):
B
: boldI
: italicU
: underlineor any combination. The default value is regular. Bold and italic styles do not apply to Symbol
and ZapfDingbats
.
size
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 is 12.
// Times regular 12
$pdf->SetFont('Times');
// Arial bold 14
$pdf->SetFont('Arial', 'B', 14);
// Remove bold
$pdf->SetFont('');
// Times bold, italic and underline 14
$pdf->SetFont('Times', 'BIU');