Com\Tecnick\Pdf\Font\Buffer
Tags
Table of Contents
- $encdiff : array<string|int, mixed>
- Array containing encoding differences
- $file : array<string|int, mixed>
- Array containing font definitions grouped by file
- $font : array<string|int, mixed>
- Array containing all fonts data
- $kunit : float
- Unit of measure conversion ratio
- $numdiffs : int
- Index for Encoding differences
- $numfonts : int
- Font counter
- $pdfa : bool
- True if we are in PDF/A mode.
- $subset : bool
- Default subset mode
- $unicode : bool
- True if we are in Unicode mode, False otherwhise.
- __construct() : string
- Initialize fonts buffer
- add() : string
- Add a new font to the fonts buffer
- addSubsetChar() : mixed
- Add a character to the subset list
- getEncDiffs() : array<string|int, mixed>
- Returns the fonts buffer
- getFont() : array<string|int, mixed>|bool
- Get font by key
- getFonts() : array<string|int, mixed>
- Returns the fonts buffer
- isSubsetMode() : bool
- Get the default subset mode
- isValidKey() : bool
- Returns true if the specified font key exist on buffer
- setFontSubKey() : mixed
- Set font sub-key value
- setFontDiff() : mixed
- Set font diff
- setFontFile() : mixed
- Set font file and subset
Properties
$encdiff
Array containing encoding differences
protected array<string|int,
mixed> $encdiff = array()
$file
Array containing font definitions grouped by file
protected array<string|int,
mixed> $file = array()
$font
Array containing all fonts data
protected array<string|int,
mixed> $font = array()
$kunit
Unit of measure conversion ratio
protected float $kunit = 1.0
$numdiffs
Index for Encoding differences
protected int $numdiffs = 0
$numfonts
Font counter
protected int $numfonts = 0
$pdfa
True if we are in PDF/A mode.
protected bool $pdfa = false
$subset
Default subset mode
protected bool $subset = false
$unicode
True if we are in Unicode mode, False otherwhise.
protected bool $unicode = true
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 $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
-
If true embedd only a subset of the font (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. 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(int $key,
int $char)
: mixed
Parameters
- $key : int
-
The font key
- $char : int
-
The Unicode character value to add
Return values
mixed —getEncDiffs()
Returns the fonts buffer
public getEncDiffs()
: array<string|int,
mixed>
Return values
array<string|int, mixed> —getFont()
Get font by key
public getFont(string $key)
: array<string|int,
mixed>|bool
Parameters
- $key : string
-
Font key
Tags
Return values
array<string|int, mixed>|bool —Returns the fonts array or false in case of missing font.
getFonts()
Returns the fonts buffer
public getFonts()
: array<string|int,
mixed>
Return values
array<string|int, mixed> —isSubsetMode()
Get the default subset mode
public isSubsetMode()
: bool
Return values
bool —isValidKey()
Returns true if the specified font key exist on buffer
public isValidKey(string $key)
: bool
Parameters
- $key : string
-
Font key
Return values
bool —setFontSubKey()
Set font sub-key value
public setFontSubKey(int $key,
int $subkey,
mixed $data)
: mixed
Parameters
- $key : int
-
The font key
- $subkey : int
-
Font sub-key
- $data : mixed
-
The data to set
Return values
mixed —setFontDiff()
Set font diff
protected setFontDiff(string $key)
: mixed
Parameters
- $key : string
-
Font key
Return values
mixed —setFontFile()
Set font file and subset
protected setFontFile(string $key)
: mixed
Parameters
- $key : string
-
Font key