SetaPDF_Core_Font_Type3 Class representing a Type3 font.

File: /SetaPDF v2/Core/Font/Type3.php

This class is only useable by existing MMType1 fonts.

Class hierarchy

Implements

Summary

Static Properties

$_fonts

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

An array caching font objects


Properties

$_avgWidth

protected integer|float SetaPDF_Core_Font_Type3::$_avgWidth

The average width of glyphs in the font.

$_charCodeCache

protected array SetaPDF_Core_Font_Type3::$_charCodeCache = array()

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

$_dictionary

protected SetaPDF_Core_Type_Dictionary SetaPDF_Core_Font_Type3::$_dictionary

The font dictionary

$_encodingTable

protected array SetaPDF_Core_Font_Type3::$_encodingTable

The encoding table.

$_fontBBox

protected array SetaPDF_Core_Font_Type3::$_fontBBox

The font bounding box

$_fontDescriptor

protected SetaPDF_Core_Font_Descriptor SetaPDF_Core_Font_Type3::$_fontDescriptor

The font descriptor object

$_fontMatrix

protected SetaPDF_Core_Geometry_Matrix SetaPDF_Core_Font_Type3::$_fontMatrix

The font matrix

$_fontName

protected string SetaPDF_Core_Font_Type3::$_fontName

The font name

$_glyphsWidthCache

protected array SetaPDF_Core_Font_Type3::$_glyphsWidthCache = array()

Cache for glyph widths

$_indirectObject

protected SetaPDF_Core_Type_IndirectObject SetaPDF_Core_Font_Type3::$_indirectObject

The indirect object of the font

$_info

protected array SetaPDF_Core_Font_Type3::$_info = array()

Array holding information about the font

$_substituteCharacter

protected string SetaPDF_Core_Font_Type3::$_substituteCharacter

The substitute character in a fonts specific encoding.

$_toUnicodeTable

protected SetaPDF_Core_Font_Cmap SetaPDF_Core_Font_Type3::$_toUnicodeTable

The to unicode table.

$_widths

protected array SetaPDF_Core_Font_Type3::$_widths

Glyph widths

$_widthsByCharCode

protected array SetaPDF_Core_Font_Type3::$_widthsByCharCode

Widths by char codes


Static Methods

freeCache()

public static SetaPDF_Core_Font::freeCache (): void

Release font instances by a document instance.

Parameters
$document : SetaPDF_Core_Document
 

freeFontCache()

public static SetaPDF_Core_Font::freeFontCache (): void

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

Throws SetaPDF_Core_Font_Exception


Methods

__construct()

_getEncodingTable()

protected SetaPDF_Core_Font_Type3::_getEncodingTable (
void
): array

Get the encoding table based on the Encoding dictionary and it's Differences entry (if available).

_getWidths()

protected SetaPDF_Core_Font_Type3::_getWidths (
void
): void

Resolves the width values from the font descriptor and fills the $_width-array.

getAscent()

public SetaPDF_Core_Font_Type3::getAscent (
void
): float|false

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

getAvgWidth()

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

Get the average glyph width.

Parameters
$calculateIfUndefined : boolean
 

getBaseEncodingTable()

Get the base encoding of the font.

If no BaseEncoding entry is available we use the Standard encoding for now. This should be extended to get the fonts build in encoding later.

getCharByCharCode()

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

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 SetaPDF_Core_Font::getCharCode (
string $char [, string $encoding = 'UTF-16BE' ]
): string

Get the final character code of a single character.

Parameters
$char : string

The character

$encoding : string

The output encoding

getCharCodes()

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

Get the final character codes of a character string.

Parameters
$chars : string

The character string

$encoding : string

The output encoding

getCharsByCharCodes()

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

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
 

getDictionary()

Get the font dictionary.

getFontDescriptor()

Get the font descriptor object.

getFontFamily()

public SetaPDF_Core_Font_Type3::getFontFamily (
void
): false

Get the font family.

Return Values

A type 3 font does not have a font family.

getFontMatrix()

getFontName()

public SetaPDF_Core_Font_Type3::getFontName (
void
): string

Get the font name.

getGlyphWidth()

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

Get the width of a glyph/character.

Parameters
$char : string
 
$encoding : string

The input encoding

See

getGlyphWidthByCharCode()

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

Get the width of a glpyh by its char code.

Parameters
$charCode : string
 

getGlyphsWidth()

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

Get the width of the glyphs/characters.

Parameters
$chars : string

The characters

$encoding : string

The input encoding

getGlyphsWidthByCharCodes()

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

Get the width of glyphs by their char codes.

Parameters
$charCodes : string
 

getIndirectObject()

getInfo()

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

Get information about the font.

Parameters
$name : string

The name of the font

getItalicAngle()

public SetaPDF_Core_Font_Type3::getItalicAngle (
void
): float

Returns the italic angle.

getMaxWidth()

public SetaPDF_Core_Font_Type3::getMaxWidth (
void
): integer|float

Get the max. glyph width.

getMissingWidth()

public SetaPDF_Core_Font_Type3::getMissingWidth (
void
): integer|float

Get the missing glyph width.

getResourceType()

public SetaPDF_Core_Font::getResourceType (
void
): string

Get the resource type.

See

getType()

public SetaPDF_Core_Font::getType (
void
): mixed

Get the Subtype entry of the font dictionary.

isBold()

public SetaPDF_Core_Font_Type3::isBold (
void
): boolean

Checks if the font is bold.

isItalic()

public SetaPDF_Core_Font_Type3::isItalic (
void
): boolean

Checks if the font is italic.

isMonospace()

public SetaPDF_Core_Font_Type3::isMonospace (
void
): boolean

Checks if the font is monospace.

splitCharCodes()

public SetaPDF_Core_Font::splitCharCodes (
string $charCodes
): array

Split a string of char codes into single char codes.

Parameters
$charCodes : string