Type1
extends AbstractFont
in package
Type1 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.
- convertToHex() : void
- Method to convert the data string to hex.
- parseAfm() : void
- Method to parse the Type1 Adobe Font Metrics file
- parsePfb() : void
- Method to parse the Type1 PFB file.
- strip() : string
- Method to strip parentheses et al from a string.
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' => [], 'missingWidth' => 0, 'numberOfHMetrics' => 0, 'italicAngle' => 0, 'capHeight' => 0, 'stemH' => 0, 'stemV' => 0, 'unitsPerEm' => 1000, 'flags' => null, 'embeddable' => true, 'dict' => null, 'data' => null, 'hex' => null, 'encoding' => null, 'length1' => null, 'length2' => null, 'fontData' => null, 'pfbPath' => null, 'afmPath' => null]
$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 Type1 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
intconvertToHex()
Method to convert the data string to hex.
protected
convertToHex() : void
parseAfm()
Method to parse the Type1 Adobe Font Metrics file
protected
parseAfm(string $afm) : void
Parameters
- $afm : string
Tags
parsePfb()
Method to parse the Type1 PFB file.
protected
parsePfb(string $pfb) : void
Parameters
- $pfb : string
Tags
strip()
Method to strip parentheses et al from a string.
protected
strip(string $str) : string
Parameters
- $str : string