Properties

$allowed

$allowed : array

Allowed properties

Type

array

$readOnly

$readOnly : array

Read-only properties

Type

array

$allowedTypes

$allowedTypes : array

Array of allowed file types.

Type

array

$fullpath

$fullpath : string

Full path of font file, i.e. '/path/to/fontfile.ext'

Type

string

$dir

$dir : string

Full, absolute directory of the font file, i.e. '/some/dir/'

Type

string

$basename

$basename : string

Full basename of font file, i.e. 'fontfile.ext'

Type

string

$filename

$filename : string

Full filename of font file, i.e. 'fontfile'

Type

string

$extension

$extension : string

Font file extension, i.e. 'ext'

Type

string

$size

$size : integer

Font file size in bytes

Type

integer

$mime

$mime : string

Font file mime type

Type

string

Methods

__construct()

__construct(string  $font) 

Constructor

Instantiate a Type1 font file object based on a pre-existing font file on disk.

Parameters

string $font

read()

read(integer  $offset = null, integer  $length = null) : string

Read data from the font file.

Parameters

integer $offset
integer $length

Returns

string

readFixed()

readFixed(integer  $mantissaBits, integer  $fractionBits, string  $bytes) : integer

Static method to read and return a fixed-point number

Parameters

integer $mantissaBits
integer $fractionBits
string $bytes

Returns

integer

readInt()

readInt(integer  $size, string  $bytes) : integer

Static method to read and return a signed integer

Parameters

integer $size
string $bytes

Returns

integer

shiftToSigned()

shiftToSigned(integer|array  $values) : integer|array

Method to shift an unpacked signed short from little endian to big endian

Parameters

integer|array $values

Returns

integer|array

toEmSpace()

toEmSpace(integer  $value) : integer

Method to convert a value to the representative value in EM.

Parameters

integer $value

Returns

integer

getWidthsForGlyphs()

getWidthsForGlyphs(array  $glyphs) : array

Get the widths for the glyphs

Parameters

array $glyphs

Returns

array

getStringWidth()

getStringWidth(string  $string, mixed  $size) : mixed

Attempt to get string width

Parameters

string $string
mixed $size

Returns

mixed

calcFlags()

calcFlags() : integer

Method to calculate the font flags

Returns

integer

offsetSet()

offsetSet(string  $name, mixed  $value) : void

Offset set method

Parameters

string $name
mixed $value

Throws

\InvalidArgumentException

offsetGet()

offsetGet(string  $name) : mixed

Offset get method

Parameters

string $name

Throws

\InvalidArgumentException

Returns

mixed

parsePfb()

parsePfb(string  $pfb) : void

Method to parse the Type1 PFB file.

Parameters

string $pfb

parseAfm()

parseAfm(string  $afm) : void

Method to parse the Type1 Adobe Font Metrics file

Parameters

string $afm

convertToHex()

convertToHex() : void

Method to convert the data string to hex.

strip()

strip(string  $str) : string

Method to strip parentheses et al from a string.

Parameters

string $str

Returns

string