TCPDF::AddFont( $family,  $style = '',  $fontfile = '',  $subset = 'default' )

Imports a TrueType, Type1, core, or CID0 font and makes it available.


Description Description

It is necessary to generate a font definition file first (read /fonts/utils/README.TXT). The definition file (and the font file itself when embedding) must be present either in the current directory or in the one indicated by K_PATH_FONTS if the constant is defined. If it could not be found, the error "Could not include font definition file" is generated.

See also See also


Top ↑

Parameters Parameters

$family

(Required) (string) Font family. The name can be chosen arbitrarily. If it is a standard family name, it will override the corresponding font.

$style

(Optional) (string) Font style. Possible values are (case insensitive):<ul><li>empty string: regular (default)</li><li>B: bold</li><li>I: italic</li><li>BI or IB: bold italic</li></ul>

Default value: ''

$fontfile

(Optional) (string) The font definition file. By default, the name is built from the family and style, in lower case with no spaces.

Default value: ''

$subset

(Optional) (mixed) if true embedd only a subset of the font (stores only the information related to the used characters); if false embedd full font; if 'default' uses the default value set using setFontSubsetting(). This option is valid only for TrueTypeUnicode fonts. If you want to enable users to change the document, set this parameter to false. If you subset the font, the person who receives your PDF would need to have your same font in order to make changes to your PDF. The file size of the PDF would also be smaller because you are embedding only part of a font.

Default value: 'default'


Top ↑

Return Return

(array) containing the font data, or false in case of error.


Top ↑

Source Source

File: includes/lib/tcpdf/tcpdf.php


			

Top ↑

Changelog Changelog

Changelog
Version Description
1.5 Introduced.

Top ↑

User Contributed Notes User Contributed Notes

You must log in before being able to contribute a note or feedback.