setasign\SetaPDF2\Core\Font\Type0
Subset Class that represents a PDF Type0 (Composite) font subset.
File: /SetaPDF v2/Core/Font/Type0/Subset.php
Old class name (alias):
\SetaPDF_Core_Font_Type0_Subset
This class will embedded a subset of the original TrueType font programm with only glyphs, that were requested by calling the getCharCodes() method.
This font allows you to use several thousands of glyphs (there's a limit of 65000 glyphs).
Class hierarchy
Implements
- \setasign\SetaPDF2\Core\Font\FontInterface
- \setasign\SetaPDF2\Core\Font\Glyph\Collection\CollectionInterface
- \setasign\SetaPDF2\Core\Resource\ResourceInterface
Summary
Methods
- __construct()
- _checkState()
- _createCidSet()
- _createCidToGidMap()
- _getSubsetFile()
- _getToUnicode()
- _getWidthArray()
- _registerChar()
- cleanUp()
- createSubset()
- getAscent()
- getCharCodes()
- getDescent()
- getDocument()
- getFontBBox()
- getFontDescriptorFlags()
- getFontFile()
- getFontName()
- getGlyphWidth()
- getGlyphWidthByCharCode()
- getGlyphsWidth()
- getIndirectObject()
- getRegisteredChars()
- getResourceType()
- getUnderlinePosition()
- getUnderlineThickness()
- setWriteCidSet()
- splitCharCodes()
Constants
STATE_FINISHED
State constant for a finished subset
STATE_NEW
State constant for a new created subset
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
The ascent value.
$_descent
The descent value.
$_factor
The scaling factor from TrueType units to glyph coordinate system.
$_fontBBox
The font bounding box.
$_fontName
The font name.
$_indirectObject
The indirect object for the PDF font object.
$_subsetFile
The instance of the subset class.
$_throwExceptionWhenMissingGlyphIsUsed
Flag saying whether an exception should be thrown if a character is not available or not.
Methods
__construct()
\SetaPDF_Core_Font_TrueType_File|string|\SetaPDF_Core_Reader_Binary $fontFile,
bool $throwExceptionWhenMissingGlyphIsUsed = false,
bool $ignoreLicenseRestrictions = false
The constructor.
Parameters
- $document : \SetaPDF_Core_Document
- $fontFile : \SetaPDF_Core_Font_TrueType_File|string|\SetaPDF_Core_Reader_Binary
- $throwExceptionWhenMissingGlyphIsUsed : bool
Whether an exception should be thrown if the registered character cannot be found or not.
- $ignoreLicenseRestrictions : bool
Can be used to disable the font license check
Exceptions
Throws \setasign\SetaPDF2\Core\Exception
Throws \setasign\SetaPDF2\Core\Font\Exception
Throws \setasign\SetaPDF2\Core\Font\TrueType\Subset\Exception
_createCidToGidMap()
Create the CIDtoGIDMap entry.
_getWidthArray()
_registerChar()
Registers a glyph that got registered in the font subsetter.
Parameters
- $char : string
- $charCode : string
createSubset()
Create the final subset file and embed it into the PDF document.
Exceptions
getCharCodes()
string $encoding = 'UTF-16BE'
Get the final character codes of a character string.
Parameters
- $chars : string
The character string
- $encoding : string
The output encoding
Exceptions
getDescent()
Returns the distance from baseline of lowest descender (Typographic descent).
Exceptions
getFontBBox()
getFontDescriptorFlags()
Get flags defining various characteristics of the font.
Exceptions
Throws \setasign\SetaPDF2\NotImplementedException
See
- PDF 32000-1:2008 - 9.8.2 Font Descriptor Flags
getFontFile()
Get the source true type file.
getFontName()
getGlyphWidth()
string $encoding = 'UTF-16BE'
Get the glyph width of a single character.
Parameters
- $char : string
The character
- $encoding : string
The encoding of the character
Exceptions
getGlyphWidthByCharCode()
Get the glyph width by a char code.
Parameters
- $charCode : string
Exceptions
getGlyphsWidth()
string $encoding = 'UTF-16BE'
Get the glyphs width of a string.
Parameters
- $chars : string
The string
- $encoding : string
The encoding of the characters
Exceptions
getIndirectObject()
Get the indirect object of this resource.
Parameters
- $document : ?\SetaPDF_Core_Document
setWriteCidSet()
Defines whether the CIDSet entry is created and written or not.
This was required for PDF/A-1 and are optional in PDF/A-2 and PDF/A-3.
Parameters
- $writeCidSet : bool