SetaPDF_Core_Font_Standard_Helvetica Class representing the PDF standard font Helvetica
File: /SetaPDF v2/Core/Font/Standard/Helvetica.php
Class hierarchy
Implements
- SetaPDF_Core_Font_FontInterface
- SetaPDF_Core_Font_Glyph_Collection_CollectionInterface
- SetaPDF_Core_Resource
Summary
Methods
- __construct()
- _ensureUnderlinePosition()
- _ensureUnderlineThickness()
- _getCharCodesTable()
- _getEncodingTable()
- _getWidths()
- getAscent()
- getAvgWidth()
- getBaseEncodingTable()
- getCapHeight()
- getCharByCharCode()
- getCharCode()
- getCharCodes()
- getCharsByCharCodes()
- getDescent()
- getDictionary()
- getFontBBox()
- getFontBBoxVector()
- getFontFamily()
- getFontName()
- getGlyphWidth()
- getGlyphWidthByCharCode()
- getGlyphsWidth()
- getIndirectObject()
- getInfo()
- getItalicAngle()
- getMaxWidth()
- getMissingWidth()
- getResourceType()
- getType()
- getUnderlinePosition()
- getUnderlineThickness()
- getXHeight()
- isBold()
- isItalic()
- isMonospace()
- recalculateFontBBox()
- setUnderlinePosition()
- setUnderlineThickness()
- splitCharCodes()
Properties
- $_ascent
- $_avgWidth
- $_capHeight
- $_charCodeCache
- $_descent
- $_dictionary
- $_encodingTable
- $_fontBBox
- $_fontBBoxVector
- $_fontFamily
- $_fontName
- $_indirectObject
- $_info
- $_isBold
- $_isItalic
- $_isMonospace
- $_italicAngle
- $_kerningPairs
- $_substituteCharacter
- $_toUnicodeTable
- $_underlinePosition
- $_underlineThickness
- $_widths
- $_widthsByCharCode
- $_xHeight
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
$_ascent
The distance from baseline of highest ascender (Typographic ascent)
$_avgWidth
The average width of glyphs in the font.
$_charCodeCache
A char code cache which is used in SetaPDF_Core_Font::getCharByCharCode()
.
$_descent
The distance from baseline of lowest descender (Typographic descent)
$_encodingTable
The encoding table
$_fontFamily
The font family
$_fontName
The font name
$_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.
$_widthsByCharCode
Widths by char codes
$_xHeight
The vertical coordinate of the top of flat non-ascending lowercase letters (like the letter x), measured from the baseline
Static Methods
_createDifferenceArray()
Creates a difference array.
Parameters
- $dictionary : SetaPDF_Core_Type_Dictionary
- $baseEncoding : string
- $diffEncoding : array
create()
Creates a font object of this font.
Parameters
- $document : SetaPDF_Core_Document
- $baseEncoding : string
- $diffEncoding : array
Exceptions
Throws SetaPDF_Core_Type_Exception
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
getDefaultDictionary()
Gets a default dictionary for this font.
Parameters
- $encoding : string
getStandardFontsToClasses()
Helper method to get all available standard font names and their class mapping.
Methods
__construct()
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).
_getCharCodesTable()
Get the map that maps character codes to unicode values.
Exceptions
Throws SetaPDF_Core_Font_Exception
_getEncodingTable()
Get the encoding table based on the Encoding dictionary and it's Differences entry (if available).
getAvgWidth()
Get the average glyph width.
Parameters
- $calculateIfUndefined : boolean
getBaseEncodingTable()
Get the base encoding table.
The base encoding of all Standard Fonts is StandardEncoding but Symbol and ZapfDingbats. They use their own encoding.
See
getCapHeight()
Get the vertical coordinate of the top of flat capital letters, measured from the baseline.
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
getFontBBoxVector()
Get a font bounding box vector.
Parameters
- $name : int
- $fontSize : float
Exceptions
Throws SetaPDF_Core_Exception
getGlyphWidth()
Get the width of a glyph/character.
Parameters
- $char : string
The character
- $encoding : string
The input encoding
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
getType()
getXHeight()
Get the vertical coordinate of the top of flat non-ascending lowercase letters (like the letter x), measured from the baseline.
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