SetaPDF_Core_Font Abstract class representing a Font

File: /SetaPDF/Core/Font.php

Class hierarchy

Implements

Summary

Constants

INFO_COPYRIGHT

const string SetaPDF_Core_Font::INFO_COPYRIGHT = 'copyright'

Info constant

INFO_CREATION_DATE

const string SetaPDF_Core_Font::INFO_CREATION_DATE = 'creationDate'

Info constant

INFO_UNIQUE_ID

const string SetaPDF_Core_Font::INFO_UNIQUE_ID = 'uniqueId'

Info constant

INFO_VERSION

const string SetaPDF_Core_Font::INFO_VERSION = 'version'

Info constant

TYPE_COLOR_SPACE

const string SetaPDF_Core_Font::TYPE_COLOR_SPACE = 'ColorSpace'

Info constant

TYPE_EXT_G_STATE

const string SetaPDF_Core_Font::TYPE_EXT_G_STATE = 'ExtGState'

Info constant

TYPE_FONT

const string SetaPDF_Core_Font::TYPE_FONT = 'Font'

Info constant

TYPE_PATTERN

const string SetaPDF_Core_Font::TYPE_PATTERN = 'Pattern'

Info constant

TYPE_PROC_SET

const string SetaPDF_Core_Font::TYPE_PROC_SET = 'ProcSet'

Info constant

TYPE_PROPERTIES

const string SetaPDF_Core_Font::TYPE_PROPERTIES = 'Properties'

Info constant

TYPE_SHADING

const string SetaPDF_Core_Font::TYPE_SHADING = 'Shading'

Info constant

TYPE_X_OBJECT

const string SetaPDF_Core_Font::TYPE_X_OBJECT = 'XObject'

Info constant


Static Properties

$_fonts

static protected array SetaPDF_Core_Font::$_fonts = array()

An array caching font objects


Properties

$_charCodeCache

protected array SetaPDF_Core_Font::$_charCodeCache = array()

A char code cache which is used in SetaPDF_Core_Font::getCharByCharCode().

$_dictionary

$_glyphsWidthCache

protected array SetaPDF_Core_Font::$_glyphsWidthCache = array()

Cache for glyph widths

$_indirectObject

The indirect object of the font

$_info

protected array SetaPDF_Core_Font::$_info = array()

Array holding information about the font

$_substituteCharacter

The substitute character in a fonts specific encoding.

$_widths

protected array SetaPDF_Core_Font::$_widths

Glyph withds

$_widthsByCharCode

Widths by char codes


Static Methods

freeCache()

static public void SetaPDF_Core_Font::freeCache ( SetaPDF_Core_Document $document )

Release font instances by a document instance.

Parameters
$document : SetaPDF_Core_Document
 

freeFontCache()

static public void SetaPDF_Core_Font::freeFontCache ( SetaPDF_Core_Document $document )

Release font instances by a document instance.

Parameters
$document : SetaPDF_Core_Document
 
See

get()

Get a font object by an indirect reference.

The needed font object class is automatically resolve via the Subtype value of the font dictionary.

Parameters
$indirectObjectOrDictionary : SetaPDF_Core_Type_IndirectObjectInterface
 
Exceptions

Throws SetaPDF_Exception_NotImplemented, SetaPDF_Core_Font_Exception


Methods

__construct()

_getCharCodesTable()

Returns the table to map character codes to unicode values.

_getEncodingTable()

Returns the encoding table.

getAscent()

abstract public float SetaPDF_Core_Font::getAscent ( void )

Returns the distance from baseline of highest ascender (Typographic ascent).

getAvgWidth()

public integer|float SetaPDF_Core_Font::getAvgWidth ( [ boolean $calculateIfUndefined = false ] )

Get the average glyph width.

Parameters
$calculateIfUndefined : boolean
 

getCharByCharCode()

public string SetaPDF_Core_Font::getCharByCharCode ( string $charCode [, string $encoding = 'UTF-8' ] )

Converts a char code from the font specific encoding to another encoding.

Parameters
$charCode : string

The char code in the font specific encoding.

$encoding : string

The resulting encoding

getCharCode()

public string SetaPDF_Core_Font::getCharCode ( string $char [, string $encoding = 'UTF-16BE' ] )

Get the final character code of a single character.

Parameters
$char : string

The character

$encoding : string

The output encoding

getCharCodes()

public array SetaPDF_Core_Font::getCharCodes ( string $chars [, string $encoding = 'UTF-16BE' ] )

Get the final character codes of a character string.

Parameters
$chars : string

The character string

$encoding : string

The output encoding

getCharsByCharCodes()

public string|array SetaPDF_Core_Font::getCharsByCharCodes ( string $charCodes [, string $encoding = 'UTF-8' [, bool $asArray = true ]] )

Converts char codes from the font specific encoding to another encoding.

Parameters
$charCodes : string

The char codes in the font specific encoding.

$encoding : string

The resulting encoding

$asArray : bool
 

getDescent()

abstract public float SetaPDF_Core_Font::getDescent ( void )

Returns the distance from baseline of lowest descender (Typographic descent).

getDictionary()

Get the font dictionary.

getFontBBox()

abstract public array SetaPDF_Core_Font::getFontBBox ( void )

Returns the font bounding box.

getFontFamily()

abstract public string SetaPDF_Core_Font::getFontFamily ( void )

Get the font family.

getFontName()

abstract public string SetaPDF_Core_Font::getFontName ( void )

Get the font name.

getGlyphWidth()

public float|int SetaPDF_Core_Font::getGlyphWidth ( string $char [, string $encoding = 'UTF-16BE' ] )

Get the width of a glyph/character.

Parameters
$char : string

The character

$encoding : string

The input encoding

getGlyphWidthByCharCode()

public float|int SetaPDF_Core_Font::getGlyphWidthByCharCode ( string $charCode )

Get the width of a glpyh by its char code.

Parameters
$charCode : string
 

getGlyphsWidth()

public float|int SetaPDF_Core_Font::getGlyphsWidth ( string $chars [, string $encoding = 'UTF-16BE' ] )

Get the width of the glyphs/characters.

Parameters
$chars : string

The characters

$encoding : string

The input encoding

getGlyphsWidthByCharCodes()

public float|int SetaPDF_Core_Font::getGlyphsWidthByCharCodes ( string $charCodes )

Get the width of glyphs by their char codes.

Parameters
$charCodes : string
 

getIndirectObject()

getInfo()

public bool|string SetaPDF_Core_Font::getInfo ( string $name )

Get information about the font.

Parameters
$name : string

The name of the font

getItalicAngle()

abstract public float SetaPDF_Core_Font::getItalicAngle ( void )

Returns the italic angle.

getMaxWidth()

public integer|float SetaPDF_Core_Font::getMaxWidth ( void )

Get the max. glyph width.

getMissingWidth()

public integer|float SetaPDF_Core_Font::getMissingWidth ( void )

Get the missing glyph width.

getResourceType()

public string SetaPDF_Core_Font::getResourceType ( void )

Get the resource type.

See

getType()

public mixed SetaPDF_Core_Font::getType ( void )

Get the Subtype entry of the font dictionary.

isBold()

abstract public boolean SetaPDF_Core_Font::isBold ( void )

Checks if the font is bold.

isItalic()

abstract public boolean SetaPDF_Core_Font::isItalic ( void )

Checks if the font is italic.

isMonospace()

abstract public boolean SetaPDF_Core_Font::isMonospace ( void )

Checks if the font is monospace.

splitCharCodes()

public array SetaPDF_Core_Font::splitCharCodes ( string $charCodes )

Split a string of char codes into single char codes.

Parameters
$charCodes : string