Com\Tecnick\Pdf\Font\Font
Tags
Table of Contents
- $data : array<string|int, mixed>
- Font data
- __construct() : mixed
- Load an imported font
- getFontData() : string
- Get the font data
- getFontkey() : string
- Get the font key
- load() : mixed
- Load the font data
- setFileData() : mixed
- Set File data
- checkType() : mixed
- Check Font Type
- findFontDirectories() : array<string|int, mixed>
- Returns a list of font directories
- findFontFile() : array<string|int, mixed>
- Load the font data
- getFontInfo() : array<string|int, mixed>
- Load the font data
- setArtificialStyles() : mixed
- Set artificial styles if the font variation file is missing
- setDefaultWidth() : mixed
- Set default width
- setName() : mixed
- Set name
- setStyle() : mixed
- Set style and normalize the font name
- setStyleMode() : string
- Set style mode properties
Properties
$data
Font data
protected array<string|int,
mixed> $data = array( 'n' => 0, // PDF
object number 'i' => 0, // font number 'key' => '', // font
key 'ifile' => '', // JSON font file 'family' => '', // font
family name 'unicode' => true, // unicode mode 'pdfa' =>
false, // PDF/A mode 'style' => '', // font style string
'fakestyle' => false, // emulated style 'mode' =>
array('bold' => false, 'italic' => false, 'underline' =>
false, 'linethrough' => false, 'overline' => false), 'type'
=> '', 'name' => '', 'desc' => array(), 'up' => -100,
'ut' => 50, 'cw' => array(), 'cbbox' => array(), 'dw'
=> 0, 'enc' => '', 'cidinfo' => array('Registry' =>
'Adobe', 'Ordering' => 'Identity', 'Supplement' => 0,
'uni2cid' => array()), 'file' => '', // original font file
'dir' => '', // font directory 'ctg' => '', // font CTG file
'diff' => '', // encoding differences 'diff_n' => 0, //
object ID of the difference object 'subset' => false, // True if
the font is subset 'subsetchars' => array(),
)
Methods
__construct()
Load an imported font
public __construct(string $font[,
string $style
= ''
][,
string $ifile
= ''
][,
bool $subset
= false
][,
bool $unicode
= true
][,
bool $pdfa
= false
][,
bool $compress
= true
]) : mixed
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
- $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 = false
-
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.
- $unicode : bool = true
-
True if we are in Unicode mode, False otherwhise.
- $pdfa : bool = false
-
True if we are in PDF/A mode.
- $compress : bool = true
-
Set to false to disable stream compression.
Tags
Return values
mixed —getFontData()
Get the font data
public getFontData()
: string
Return values
string —getFontkey()
Get the font key
public getFontkey()
: string
Return values
string —load()
Load the font data
public load()
: mixed
Tags
Return values
mixed —setFileData()
Set File data
public setFileData()
: mixed
Return values
mixed —checkType()
Check Font Type
protected checkType()
: mixed
Return values
mixed —findFontDirectories()
Returns a list of font directories
protected findFontDirectories()
: array<string|int,
mixed>
Return values
array<string|int, mixed> —Font directories
findFontFile()
Load the font data
protected findFontFile()
: array<string|int,
mixed>
Tags
Return values
array<string|int, mixed> —Font data
getFontInfo()
Load the font data
protected getFontInfo()
: array<string|int,
mixed>
Tags
Return values
array<string|int, mixed> —Font data
setArtificialStyles()
Set artificial styles if the font variation file is missing
protected setArtificialStyles()
: mixed
Return values
mixed —setDefaultWidth()
Set default width
protected setDefaultWidth()
: mixed
Return values
mixed —setName()
Set name
protected setName()
: mixed
Return values
mixed —setStyle()
Set style and normalize the font name
protected setStyle(string $style)
: mixed
Parameters
- $style : string
-
Style
Return values
mixed —setStyleMode()
Set style mode properties
protected setStyleMode(string $style)
: string
Parameters
- $style : string
-
Style
Return values
string —Style