Documentation

OpenType extends TrueType
in package

OpenType font class

Tags
category

Pop

author

Nick Sagona, III dev@nolainteractive.com

copyright

Copyright (c) 2009-2023 NOLA Interactive, LLC. (http://www.nolainteractive.com)

license

http://www.popphp.org/license New BSD License

version
4.2.0

Table of Contents

$allowedTypes  : array<string|int, mixed>
Array of allowed file types.
$basename  : string
Full basename of font file, i.e. 'fontfile.ext'
$dir  : string
Full, absolute directory of the font file, i.e. '/some/dir/'
$extension  : string
Font file extension, i.e. 'ext'
$filename  : string
Full filename of font file, i.e. 'fontfile'
$fullpath  : string
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
Font stream
__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
Read data from the font file.
readFixed()  : 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 OpenType 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 $basename = null

$dir

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

protected string $dir = null

$extension

Font file extension, i.e. 'ext'

protected string $extension = null

$filename

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

protected string $filename = null

$fullpath

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

protected string $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]

$readOnly

Read-only properties

protected array<string|int, mixed> $readOnly = []

Methods

__construct()

Constructor

public __construct([string $fontFile = null ][, string $fontStream = null ]) : mixed

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

Parameters
$fontFile : string = null
$fontStream : string = null
Return values
mixed

__get()

Get method

public __get(string $name) : mixed
Parameters
$name : string
Return values
mixed

__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
Return values
void

__unset()

Unset fields[$name]

public __unset(string $name) : void
Parameters
$name : string
Return values
void

calcFlags()

Method to calculate the font flags

public calcFlags() : int
Return values
int

getStringWidth()

Attempt to get string width

public getStringWidth(string $string, mixed $size) : mixed
Parameters
$string : string
$size : mixed
Return values
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
bool

offsetGet()

Offset get method

public offsetGet(string $name) : mixed
Parameters
$name : string
Tags
throws
InvalidArgumentException
Return values
mixed

offsetSet()

Offset set method

public offsetSet(string $name, mixed $value) : void
Parameters
$name : string
$value : mixed
Return values
void

offsetUnset()

Offset unset method

public offsetUnset(mixed $offset) : void
Parameters
$offset : mixed
Return values
void

read()

Read data from the font file.

public read([int $offset = null ][, int $length = null ]) : string
Parameters
$offset : int = null
$length : int = null
Return values
string

readFixed()

Static method to read and return a fixed-point number

public readFixed(int $mantissaBits, int $fractionBits, string $bytes) : int
Parameters
$mantissaBits : int
$fractionBits : int
$bytes : string
Return values
int

readInt()

Static method to read and return a signed integer

public readInt(int $size, string $bytes) : int
Parameters
$size : int
$bytes : string
Return values
int

shiftToSigned()

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
int

parseCommonTables()

Method to parse the common tables of the TrueType font file.

protected parseCommonTables() : void
Return values
void

parseName()

Method to parse the TTF info of the TrueType font file from the name table.

protected parseName() : void
Return values
void

parseRequiredTables()

Method to parse the required tables of the OpenType font file.

protected parseRequiredTables() : void
Return values
void

parseTtfTable()

Method to parse the TTF header and table of the TrueType font file.

protected parseTtfTable() : void
Return values
void

Search results