setasign\SetaPDF2\Core\Font\Standard

Symbol Class representing the PDF standard font Symbol

File: /SetaPDF v2/Core/Font/Standard/Symbol.php
Old class name (alias): \SetaPDF_Core_Font_Standard_Symbol

Class hierarchy

Implements

Summary

Constants

INFO_COPYRIGHT

public const string \setasign\SetaPDF2\Core\Font\Font::INFO_COPYRIGHT = 'copyright'

Info constant

INFO_CREATION_DATE

public const string \setasign\SetaPDF2\Core\Font\Font::INFO_CREATION_DATE = 'creationDate'

Info constant

INFO_UNIQUE_ID

public const string \setasign\SetaPDF2\Core\Font\Font::INFO_UNIQUE_ID = 'uniqueId'

Info constant

INFO_VERSION

public const string \setasign\SetaPDF2\Core\Font\Font::INFO_VERSION = 'version'

Info constant

TYPE_COLOR_SPACE

Type constant

TYPE_EXT_G_STATE

Type constant

TYPE_FONT

Type constant

TYPE_PATTERN

Type constant

TYPE_PROC_SET

Type constant

TYPE_PROPERTIES

Type constant

TYPE_SHADING

Type constant

TYPE_X_OBJECT

Type constant


Properties

$_ascent

protected AbstractStandard::$_ascent = 0

The distance from baseline of highest ascender (Typographic ascent)

$_avgWidth

The average width of glyphs in the font.

$_capHeight

protected float AbstractStandard::$_capHeight = 0

The vertical coordinate of the top of flat capital letters, measured from the baseline.

$_charCodeCache

$_descent

The distance from baseline of lowest descender (Typographic descent)

$_encodingTable

The encoding table

$_fontBBox

protected array AbstractStandard::$_fontBBox = array()

The font bounding box

$_fontBBoxVector

$_fontFamily

protected string AbstractStandard::$_fontFamily

The font family

$_fontName

protected string AbstractStandard::$_fontName

The font name

$_indirectObject

$_info

protected array \setasign\SetaPDF2\Core\Font\Font::$_info = array()

Array holding information about the font

$_isBold

protected bool AbstractStandard::$_isBold = false

Flag indicating if this font is bold.

$_isItalic

protected bool AbstractStandard::$_isItalic = false

Flag indicating if this font is italic.

$_isMonospace

protected bool AbstractStandard::$_isMonospace = false

Flag indicating if this font is monospace.

$_italicAngle

protected float AbstractStandard::$_italicAngle = 0

The italic angle

$_kerningPairs

protected array AbstractStandard::$_kerningPairs = array()

Kerning pairs

$_substituteCharacter

The UTF-16BE unicode value for a substitute character

$_toUnicodeTable

The map that maps character codes to uncidoe values

$_underlinePosition

The relative underline positioning.

$_underlineThickness

The underline thickness.

$_widths

protected array AbstractStandard::$_widths = array()

Glyph widths

$_widthsByCharCode

Widths by char codes

$_xHeight

protected float AbstractStandard::$_xHeight = 0

The vertical coordinate of the top of flat non-ascending lowercase letters (like the letter x), measured from the baseline


Static Methods

_createDifferenceArray()

protected static AbstractStandard::_createDifferenceArray (
\SetaPDF_Core_Type_Dictionary $dictionary,
string $baseEncoding,
array $diffEncoding
): void

Creates a difference array.

Parameters
$dictionary : \SetaPDF_Core_Type_Dictionary
 
$baseEncoding : string
 
$diffEncoding : array
 

create()

public static Symbol::create (
\SetaPDF_Core_Document $document,
string $baseEncoding = null,
array $diffEncoding = array ( )
): \SetaPDF_Core_Font_Standard_Symbol

Creates a font object of this font.

Parameters
$document : \SetaPDF_Core_Document
 
$baseEncoding : string
 
$diffEncoding : array
 
Exceptions

Throws \setasign\SetaPDF2\Core\Type\Exception

freeCache()

WARNING: This method is marked as deprecated!

Call \setasign\SetaPDF2\Core\Document::clearCache() with the type \setasign\SetaPDF2\Core\Document::CACHE_FONT instead.

Release font instances by a document instance.

Parameters
$document : \SetaPDF_Core_Document
 

freeFontCache()

WARNING: This method is marked as deprecated!

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|\SetaPDF_Core_Type_Dictionary
 
Exceptions

Throws \setasign\SetaPDF2\NotImplementedException

Throws \setasign\SetaPDF2\Core\Font\Exception

Throws \setasign\SetaPDF2\Core\Type\IndirectReference\Exception

Throws \setasign\SetaPDF2\Core\Type\Exception

getDefaultDictionary()

Gets a default dictionary for this font.

getStandardFontsToClasses()

public static AbstractStandard::getStandardFontsToClasses (
void
): array

Helper method to get all available standard font names and their class mapping.


Methods

__construct()

_ensureUnderlinePosition()

Calculates the underline position.

This method is only used if no underline thickness is provided by the font implementation (e.g. through an already embedded font). We simply use the font bounding box to calculate a meaningful value.

_ensureUnderlineThickness()

Calculates the underline thickness.

This method is only used if no underline thickness is provided by the font implementation (e.g. through an already embedded font).

_getCharCodesTable()

Get the map that maps character codes to unicode values.

Exceptions

Throws \setasign\SetaPDF2\Core\Font\Exception

_getEncodingTable()

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

_getWidths()

protected AbstractStandard::_getWidths (
void
): void

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

getAscent()

public AbstractStandard::getAscent (
void
): float

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

getAvgWidth()

public \setasign\SetaPDF2\Core\Font\Simple::getAvgWidth (
bool $calculateIfUndefined = false
): int|float

Get the average glyph width.

Parameters
$calculateIfUndefined : bool
 

getBaseEncodingTable()

public Symbol::getBaseEncodingTable (
void
): array

Get the base encoding table.

getCapHeight()

public AbstractStandard::getCapHeight (
void
): float

Get the vertical coordinate of the top of flat capital letters, measured from the baseline.

getCharByCharCode()

public Symbol::getCharByCharCode (
string $charCode,
string $encoding = 'UTF-8',
bool $normalize = false
): 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

$normalize : bool

Specifies if unknown mappings (e.g. to points in the private unicode area) should be mapped to meaningful values.

getCharCode()

public \setasign\SetaPDF2\Core\Font\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 \setasign\SetaPDF2\Core\Font\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 \setasign\SetaPDF2\Core\Font\Font::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
 

getDescent()

public AbstractStandard::getDescent (
void
): float

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

getDictionary()

getFontBBox()

public AbstractStandard::getFontBBox (
void
): array

Returns the font bounding box.

getFontBBoxVector()

Get a font bounding box vector.

Parameters
$name : int
 
$fontSize : float
 
Exceptions

Throws \setasign\SetaPDF2\Core\Exception

getFontFamily()

public AbstractStandard::getFontFamily (
void
): string

Get the font family.

getFontName()

public AbstractStandard::getFontName (
void
): string

Get the font name.

getGlyphWidth()

public \setasign\SetaPDF2\Core\Font\Font::getGlyphWidth (
string $char,
string $encoding = 'UTF-16BE'
): float|int

Get the width of a glyph/character.

Parameters
$char : string

The character

$encoding : string

The input encoding

getGlyphWidthByCharCode()

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

Get the width of a glpyh by its char code.

Parameters
$charCode : string
 

getGlyphsWidth()

public \setasign\SetaPDF2\Core\Font\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

getInfo()

public \setasign\SetaPDF2\Core\Font\Font::getInfo (
string $name
): bool|string

Get information about the font.

Parameters
$name : string

The name of the font

getItalicAngle()

public AbstractStandard::getItalicAngle (
void
): float

Returns the italic angle.

getMaxWidth()

Get the max. glyph width.

getMissingWidth()

Get the missing glyph width.

getType()

Get the Subtype entry of the font dictionary.

Exceptions

Throws \setasign\SetaPDF2\Core\Type\Exception

getUnderlinePosition()

Get the underline position.

getUnderlineThickness()

Get the underline thickness.

getXHeight()

public AbstractStandard::getXHeight (
void
): float

Get the vertical coordinate of the top of flat non-ascending lowercase letters (like the letter x), measured from the baseline.

isBold()

public AbstractStandard::isBold (
void
): bool

Checks if the font is bold.

isItalic()

public AbstractStandard::isItalic (
void
): bool

Checks if the font is italic.

isMonospace()

public AbstractStandard::isMonospace (
void
): bool

Checks if the font is monospace.

recalculateFontBBox()

Re-calculate the font bounding box by analysing the metrics of all embedded glyphs.

Return Values

Format is [llx lly urx ury]. Returns false if the font isn't recalculatable

setUnderlinePosition()

public \setasign\SetaPDF2\Core\Font\Font::setUnderlinePosition (
int|float $position
): void

Sets the underline position for the current font.

Parameters
$position : int|float
 

setUnderlineThickness()

public \setasign\SetaPDF2\Core\Font\Font::setUnderlineThickness (
int|float $thickness
): void

Sets the underline thickness for the current font.

Parameters
$thickness : int|float
 

splitCharCodes()

public \setasign\SetaPDF2\Core\Font\Font::splitCharCodes (
string $charCodes
): array

Split a string of char codes into single char codes.

Parameters
$charCodes : string