TrueType
extends AbstractFont
in package
TrueType font class
Tags
Table of Contents
Properties
- $allowedTypes : array<string|int, mixed>
- Array of allowed file types.
- $basename : string|null
- Full basename of font file, i.e. 'fontfile.ext'
- $dir : string|null
- Full, absolute directory of the font file, i.e. '/some/dir/'
- $extension : string|null
- Font file extension, i.e. 'ext'
- $filename : string|null
- Full filename of font file, i.e. 'fontfile'
- $fullpath : string|null
- Full path of font file, i.e. '/path/to/fontfile.ext'
- $mime : string
- Font file mime type
- $properties : array<string|int, mixed>
- Font properties
- $readOnly : array<string|int, mixed>
- Read-only properties
- $size : int
- Font file size in bytes
- $stream : string|null
- Font stream
Methods
- __construct() : mixed
- Constructor
- __get() : mixed
- Get method
- __isset() : bool
- Isset method
- __set() : void
- Set method
- __unset() : void
- Unset fields[$name]
- calcFlags() : int
- Method to calculate the font flags
- getStringWidth() : mixed
- Attempt to get string width
- getWidthsForGlyphs() : array<string|int, mixed>
- Get the widths for the glyphs
- offsetExists() : bool
- Offset exists method
- offsetGet() : mixed
- Offset get method
- offsetSet() : void
- Offset set method
- offsetUnset() : void
- Offset unset method
- read() : string|null
- Read data from the font file.
- readFixed() : float|int
- Static method to read and return a fixed-point number
- readInt() : int
- Static method to read and return a signed integer
- shiftToSigned() : int|array<string|int, mixed>
- Method to shift an unpacked signed short from little endian to big endian
- toEmSpace() : int
- Method to convert a value to the representative value in EM.
- parseCommonTables() : void
- Method to parse the common tables of the TrueType font file.
- parseName() : void
- Method to parse the TTF info of the TrueType font file from the name table.
- parseRequiredTables() : void
- Method to parse the required tables of the TrueType font file.
- parseTtfTable() : void
- Method to parse the TTF header and table of the TrueType font file.
Properties
$allowedTypes
Array of allowed file types.
protected
array<string|int, mixed>
$allowedTypes
= ['afm' => 'application/x-font-afm', 'otf' => 'application/x-font-otf', 'pfb' => 'application/x-font-pfb', 'pfm' => 'application/x-font-pfm', 'ttf' => 'application/x-font-ttf']
$basename
Full basename of font file, i.e. 'fontfile.ext'
protected
string|null
$basename
= null
$dir
Full, absolute directory of the font file, i.e. '/some/dir/'
protected
string|null
$dir
= null
$extension
Font file extension, i.e. 'ext'
protected
string|null
$extension
= null
$filename
Full filename of font file, i.e. 'fontfile'
protected
string|null
$filename
= null
$fullpath
Full path of font file, i.e. '/path/to/fontfile.ext'
protected
string|null
$fullpath
= null
$mime
Font file mime type
protected
string
$mime
= 'text/plain'
$properties
Font properties
protected
array<string|int, mixed>
$properties
= ['info' => null, 'bBox' => null, 'ascent' => 0, 'descent' => 0, 'numberOfGlyphs' => 0, 'glyphWidths' => [], 'rawGlyphWidths' => [], 'cmap' => ['glyphIndexArray' => [], 'glyphNumbers' => []], 'missingWidth' => 0, 'numberOfHMetrics' => 0, 'italicAngle' => 0, 'capHeight' => 0, 'stemH' => 0, 'stemV' => 0, 'unitsPerEm' => 1000, 'flags' => null, 'embeddable' => true, 'header' => null, 'ttfHeader' => null, 'ttfTable' => null, 'tables' => [], 'tableInfo' => []]
$readOnly
Read-only properties
protected
array<string|int, mixed>
$readOnly
= []
$size
Font file size in bytes
protected
int
$size
= 0
$stream
Font stream
protected
string|null
$stream
= null
Methods
__construct()
Constructor
public
__construct([string|null $fontFile = null ][, string|null $fontStream = null ]) : mixed
Instantiate a TrueType font file object based on a pre-existing font file on disk.
Parameters
- $fontFile : string|null = null
- $fontStream : string|null = null
Tags
__get()
Get method
public
__get(string $name) : mixed
Parameters
- $name : string
__isset()
Isset method
public
__isset(string $name) : bool
Parameters
- $name : string
Return values
bool__set()
Set method
public
__set(string $name, mixed $value) : void
Parameters
- $name : string
- $value : mixed
__unset()
Unset fields[$name]
public
__unset(string $name) : void
Parameters
- $name : string
calcFlags()
Method to calculate the font flags
public
calcFlags() : int
Return values
intgetStringWidth()
Attempt to get string width
public
getStringWidth(string $string, mixed $size) : mixed
Parameters
- $string : string
- $size : mixed
getWidthsForGlyphs()
Get the widths for the glyphs
public
getWidthsForGlyphs(array<string|int, mixed> $glyphs) : array<string|int, mixed>
Parameters
- $glyphs : array<string|int, mixed>
Return values
array<string|int, mixed>offsetExists()
Offset exists method
public
offsetExists(mixed $offset) : bool
Parameters
- $offset : mixed
Return values
booloffsetGet()
Offset get method
public
offsetGet(string $offset) : mixed
Parameters
- $offset : string
offsetSet()
Offset set method
public
offsetSet(mixed $offset, mixed $value) : void
Parameters
- $offset : mixed
- $value : mixed
offsetUnset()
Offset unset method
public
offsetUnset(mixed $offset) : void
Parameters
- $offset : mixed
read()
Read data from the font file.
public
read([int|null $offset = null ][, int|null $length = null ]) : string|null
Parameters
- $offset : int|null = null
- $length : int|null = null
Return values
string|nullreadFixed()
Static method to read and return a fixed-point number
public
readFixed(int $mantissaBits, int $fractionBits, string $bytes) : float|int
Parameters
- $mantissaBits : int
- $fractionBits : int
- $bytes : string
Return values
float|intreadInt()
Static method to read and return a signed integer
public
readInt(int $size, string $bytes) : int
Parameters
- $size : int
- $bytes : string
Return values
intshiftToSigned()
Method to shift an unpacked signed short from little endian to big endian
public
shiftToSigned(int|array<string|int, mixed> $values) : int|array<string|int, mixed>
Parameters
- $values : int|array<string|int, mixed>
Return values
int|array<string|int, mixed>toEmSpace()
Method to convert a value to the representative value in EM.
public
toEmSpace(int $value) : int
Parameters
- $value : int
Return values
intparseCommonTables()
Method to parse the common tables of the TrueType font file.
protected
parseCommonTables() : void
parseName()
Method to parse the TTF info of the TrueType font file from the name table.
protected
parseName() : void
parseRequiredTables()
Method to parse the required tables of the TrueType font file.
protected
parseRequiredTables() : void
parseTtfTable()
Method to parse the TTF header and table of the TrueType font file.
protected
parseTtfTable() : void