setasign\SetaPDF2\Core\Font
Type1 Class for Type1 fonts
File: /SetaPDF v2/Core/Font/Type1.php            
        Old class name (alias):
        \SetaPDF_Core_Font_Type1    
Class hierarchy
Implements
- DescriptorInterface
- FontInterface
- Glyph\Collection\CollectionInterface
- \setasign\SetaPDF2\Core\Resource\ResourceInterface
Summary
Methods
- __construct()
- _ensureUnderlinePosition()
- _ensureUnderlineThickness()
- _getCharCodesTable()
- _getEncodingTable()
- _getWidths()
- getAscent()
- getAvgWidth()
- getBaseEncodingTable()
- getCharByCharCode()
- getCharCode()
- getCharCodes()
- getCharsByCharCodes()
- getDescent()
- getDictionary()
- getFontBBox()
- getFontBBoxVector()
- getFontDescriptor()
- getFontFamily()
- getFontName()
- getGlyphWidth()
- getGlyphWidthByCharCode()
- getGlyphsWidth()
- getIndirectObject()
- getInfo()
- getItalicAngle()
- getMaxWidth()
- getMissingWidth()
- getResourceType()
- 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.
$_charCodeCache
A char code cache which is used in Font::getCharByCharCode().
$_encodingTable
The encoding table
$_fontBBox                
                
                                        
            The font bounding box
$_fontDescriptor                
                
                                        
            The font descriptor object
$_substituteCharacter                
                
                                        
            The UTF-16BE unicode value for a substitute character
$_toUnicodeTable
The map that maps character codes to unicode values
$_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 \setasign\SetaPDF2\Core\Document::clearCache() with the type \setasign\SetaPDF2\Core\Document::CACHE_FONT instead.
Release font instances by a document instance.
Parameters
- $document : \setasign\SetaPDF2\Core\Document
freeFontCache()
WARNING: This method is marked as deprecated!
Release font instances by a document instance.
Parameters
- $document : \setasign\SetaPDF2\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 : \setasign\SetaPDF2\Core\Type\IndirectObjectInterface|\setasign\SetaPDF2\Core\Type\PdfDictionary
Exceptions
Throws \setasign\SetaPDF2\NotImplementedException
Throws Exception
Throws \setasign\SetaPDF2\Core\Type\IndirectReference\Exception
Methods
__construct()
                
                
                                        
            The constructor.
Parameters
- $indirectObjectOrDictionary : \setasign\SetaPDF2\Core\Type\IndirectObjectInterface|\setasign\SetaPDF2\Core\Type\PdfDictionary
Exceptions
Throws 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).
_getCharCodesTable()
_getEncodingTable()
Get the encoding table based on the Encoding dictionary and it's Differences entry (if available).
_getWidths()
                
                
                                        
            Resolves the width values from the font descriptor and fills the Type1::$_widths-array.
Exceptions
Throws \setasign\SetaPDF2\Core\Type\Exception
Throws Exception
getAvgWidth()
                
                
                                        
            
        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()
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()
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()
                
                
                                        
            Returns the distance from baseline of lowest descender (Typographic descent).
Exceptions
Throws Exception
getFontBBoxVector()
float $fontSize
Get a font bounding box vector.
Parameters
- $name : int
- $fontSize : float
Exceptions
getGlyphWidth()
                
                
                                        
            Get the width of a glyph/character.
Parameters
- $char : string
- $encoding : string
- The input encoding 
Exceptions
Throws Exception
Throws \setasign\SetaPDF2\Core\Type\Exception
See
getGlyphWidthByCharCode()
                
                
                                        
            
        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 : ?\setasign\SetaPDF2\Core\Document
Exceptions
Throws \InvalidArgumentException
See
getMissingWidth()
                
                
                                        
            
        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()
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
