Documentation

AbstractFont
in package
implements ArrayAccess

AbstractYes

Font abstract class

Tags
category

Pop

author

Nick Sagona, III dev@nolainteractive.com

copyright

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

license

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

version
5.2.0

Table of Contents

Interfaces

ArrayAccess

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.

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]

$readOnly

Read-only properties

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

$stream

Font stream

protected string|null $stream = null

Methods

__construct()

Constructor

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

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

Parameters
$fontFile : string|null = null
$fontStream : string|null = null
Tags
throws
Exception|Exception

__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
int

getStringWidth()

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
bool

offsetGet()

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|null

readFixed()

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|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

        
On this page

Search results