SetaPDF_Core_Font_Type0 Class for Type0 fonts
File: /SetaPDF v2/Core/Font/Type0.php
Class hierarchy
Implements
- SetaPDF_Core_Font_DescriptorInterface
- SetaPDF_Core_Font_FontInterface
- SetaPDF_Core_Font_Glyph_Collection_CollectionInterface
- SetaPDF_Core_Resource
Summary
Methods
- __construct()
- _ensureUnderlinePosition()
- _ensureUnderlineThickness()
- _getEncodingTable()
- getAscent()
- getAvgWidth()
- getCharByCharCode()
- getCharCode()
- getCharCodes()
- getCharsByCharCodes()
- getDescendantFont()
- getDictionary()
- getFontBBox()
- getFontBBoxVector()
- getFontDescriptor()
- getFontFamily()
- getFontName()
- getGlyphWidthByCharCode()
- getGlyphsWidth()
- getIndirectObject()
- getInfo()
- getItalicAngle()
- getMaxWidth()
- getMissingWidth()
- getResourceType()
- getStreamParser()
- getType()
- getUnderlinePosition()
- getUnderlineThickness()
- isBold()
- isItalic()
- isMonospace()
- recalculateFontBBox()
- setUnderlinePosition()
- setUnderlineThickness()
- splitCharCodes()
Constants
INFO_COPYRIGHT
Info constant
INFO_CREATION_DATE
Info constant
INFO_UNIQUE_ID
Info constant
INFO_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
$_avgWidth
The average width of glyphs in the font.
$_calculatedFontBBox
$_charCodeCache
A char code cache which is used in SetaPDF_Core_Font::getCharByCharCode()
.
$_fontBBox
The font bounding box
$_substituteCharacter
The substitute character in a fonts specific encoding.
$_underlinePosition
The relative underline positioning.
$_underlineThickness
The underline thickness.
$_widthsByCharCode
Widths by char codes
Static Methods
freeCache()
WARNING: This method is marked as deprecated!
Call SetaPDF_Core_Document::clearCache()
with the type
SetaPDF_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 SetaPDF_Exception_NotImplemented
Throws SetaPDF_Core_Font_Exception
Throws SetaPDF_Core_Type_IndirectReference_Exception
Throws SetaPDF_Core_Type_Exception
Methods
__construct()
The constructor.
Parameters
- $indirectObjectOrDictionary : SetaPDF_Core_Type_IndirectObjectInterface|SetaPDF_Core_Type_Dictionary
Exceptions
Throws SetaPDF_Core_Type_Exception
_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).
_getEncodingTable()
Get the CMaps table for this font.
Exceptions
Throws SetaPDF_Core_Font_Exception
Throws SetaPDF_Core_Type_Exception
getAscent()
Returns the distance from baseline of highest ascender (Typographic ascent).
Exceptions
Throws SetaPDF_Core_Font_Exception
Throws SetaPDF_Core_Type_Exception
getAvgWidth()
Get the average glyph width.
Parameters
- $calculateIfUndefined : boolean
Exceptions
Throws SetaPDF_Core_Font_Exception
Throws SetaPDF_Core_Type_Exception
getCharByCharCode()
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()
Get the final character code of a single character.
Parameters
- $char : string
The character
- $encoding : string
The output encoding
getCharCodes()
Get the final character codes of a character string.
Parameters
- $chars : string
The character string
- $encoding : string
The output encoding
getCharsByCharCodes()
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
Exceptions
Throws SetaPDF_Core_Font_Exception
Throws SetaPDF_Core_Type_Exception
getDescendantFont()
Get the descendant font.
Exceptions
Throws SetaPDF_Exception_NotImplemented
Throws SetaPDF_Core_Font_Exception
Throws SetaPDF_Core_Type_Exception
getFontBBox()
Returns the font bounding box.
Exceptions
Throws SetaPDF_Core_Font_Exception
Throws SetaPDF_Core_Type_Exception
getFontBBoxVector()
Get a font bounding box vector.
Parameters
- $name : int
- $fontSize : float
Exceptions
Throws SetaPDF_Core_Exception
getFontDescriptor()
Get the font descriptor object.
Exceptions
Throws SetaPDF_Core_Font_Exception
Throws SetaPDF_Core_Type_Exception
getFontFamily()
Get the font family.
Exceptions
Throws SetaPDF_Core_Font_Exception
Throws SetaPDF_Core_Type_Exception
getFontName()
getGlyphWidthByCharCode()
Get the width of a glpyh by its char code.
Parameters
- $charCode : string
Exceptions
Throws SetaPDF_Core_Font_Exception
Throws SetaPDF_Core_Type_Exception
getGlyphsWidth()
Get the width of the glyphs/characters.
Parameters
- $chars : string
The characters
- $encoding : string
The input encoding
getIndirectObject()
Gets an indirect object for this font.
Parameters
- $document : SetaPDF_Core_Document
Exceptions
Throws InvalidArgumentException
See
getItalicAngle()
Returns the italic angle.
Exceptions
Throws SetaPDF_Core_Font_Exception
Throws SetaPDF_Core_Type_Exception
getMaxWidth()
Get the max glyph width.
Exceptions
Throws SetaPDF_Core_Font_Exception
Throws SetaPDF_Core_Type_Exception
getMissingWidth()
Get the missing glyph width.
Exceptions
Throws SetaPDF_Core_Font_Exception
Throws SetaPDF_Core_Type_Exception
getStreamParser()
Get the TTF/OTF parser for the embedded font programm.
Exceptions
Throws SetaPDF_Core_Exception
Throws SetaPDF_Core_Font_Exception
Throws SetaPDF_Core_Type_Exception
getType()
isBold()
Checks if the font is bold.
Exceptions
Throws SetaPDF_Core_Font_Exception
Throws SetaPDF_Core_Type_Exception
isItalic()
Checks if the font is italic.
Exceptions
Throws SetaPDF_Core_Font_Exception
Throws SetaPDF_Core_Type_Exception
isMonospace()
Checks if the font is monospace.
Exceptions
Throws SetaPDF_Core_Font_Exception
Throws SetaPDF_Core_Type_Exception
recalculateFontBBox()
Exceptions
Throws SetaPDF_Core_Exception
Throws SetaPDF_Core_Font_Exception
Throws SetaPDF_Core_Type_Exception
setUnderlinePosition()
Sets the underline position for the current font.
Parameters
- $position : int|float
setUnderlineThickness()
Sets the underline thickness for the current font.
Parameters
- $thickness : int|float
splitCharCodes()
Split a string of char codes into single char codes.
Parameters
- $charCodes : string
Exceptions
Throws SetaPDF_Core_Font_Exception
Throws SetaPDF_Core_Type_Exception