Buffer
in package
Com\Tecnick\Pdf\Font\Buffer
Tags
Table of Contents
Methods
- __construct() : string
- Initialize fonts buffer
- add() : string
- Add a new font to the fonts buffer
- addSubsetChar() : void
- Add a character to the subset list
- getEncDiffs() : array<int, string>
- Returns the fonts buffer
- getFont() : TFontData
- Get font by key
- getFonts() : array<string, TFontData>
- Returns the fonts buffer
- isSubsetMode() : bool
- Get the default subset mode
- isValidKey() : bool
- Returns true if the specified font key exist on buffer
Methods
__construct()
Initialize fonts buffer
public __construct(float $kunit[,
bool $subset
= false
][,
bool $unicode
= true
][,
bool $pdfa
= false
]) : string
Parameters
- $kunit : float
-
Unit of measure conversion ratio.
- $subset : bool = false
-
If true embedd only a subset of the fonts (stores only the information related to the used characters); If false embedd full font; This option is valid only for TrueTypeUnicode fonts and it is disabled for PDF/A. If you want to enable users to modify 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 a subset. NOTE: This option is computational and memory intensive.
- $unicode : bool = true
-
True if we are in Unicode mode, False otherwhise.
- $pdfa : bool = false
-
True if we are in PDF/A mode.
Tags
Return values
string —Font key
add()
Add a new font to the fonts buffer
public add(int &$objnum,
string $font[,
string $style
= ''
][,
string $ifile
= ''
][,
bool|null $subset
= null
]) : string
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.
Parameters
- $objnum : int
-
Current PDF object number
- $font : string
-
Font family. If it is a standard family name, it will override the corresponding font.
- $style : string = ''
-
Font style. Possible values are (case insensitive): regular (default) B: bold I: italic U: underline D: strikeout (linethrough) O: overline
- $ifile : string = ''
-
The font definition file (or empty for autodetect). By default, the name is built from the family and style, in lower case with no spaces.
- $subset : bool|null = null
-
If true embed only a subset of the font (stores only the information related to the used characters); If false embed full font; This option is valid only for TrueTypeUnicode fonts and it is disabled for PDF/A. If you want to enable users to modify 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 a subset. Set this to null to use the default value. NOTE: This option is computational and memory intensive.
Tags
Return values
string —Font key
addSubsetChar()
Add a character to the subset list
public addSubsetChar(string $key,
int $char)
: void
Parameters
- $key : string
-
The font key
- $char : int
-
The Unicode character value to add
getEncDiffs()
Returns the fonts buffer
public getEncDiffs()
: array<int,
string>
Return values
array<int, string>getFont()
Get font by key
public getFont(string $key)
: TFontData
Parameters
- $key : string
-
Font key
Tags
Return values
TFontData —Returns the fonts array.
getFonts()
Returns the fonts buffer
public getFonts()
: array<string,
TFontData>
Return values
array<string, TFontData>isSubsetMode()
Get the default subset mode
public isSubsetMode()
: bool
Return values
boolisValidKey()
Returns true if the specified font key exist on buffer
public isValidKey(string $key)
: bool
Parameters
- $key : string
-
Font key