Abstract helper class for {@link Zend_Pdf_Font} that parses font files.
Defines the public interface for concrete subclasses which are responsible for parsing the raw binary data from the font file on disk. Also provides a debug logging interface and a couple of shared utility methods.
package | Zend_Pdf |
---|---|
subpackage | FileParser |
copyright | Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com) |
license | New BSD License |
inherited_from | \Zend_Pdf_FileParser |
__construct(\Zend_Pdf_FileParserDataSource $dataSource)
Validates the data source and enables debug logging if so configured.
inherited_from | \Zend_Pdf_FileParser::__construct() |
---|
\Zend_Pdf_FileParserDataSource
\Zend_Pdf_Exception |
---|
__construct(\Zend_Pdf_FileParserDataSource $dataSource)
Verifies that the data source has been properly initialized.
\Zend_Pdf_FileParserDataSource
\Zend_Pdf_Exception |
---|
__destruct()
Discards the data source object.
__get(string $property) : mixed
string
mixed
__set(string $property, mixed $value)
NOTE: This method is protected. Other classes may freely interrogate the font properties, but only this and its subclasses may set them.
string
mixed
getDataSource() : \Zend_Pdf_FileParserDataSource
\Zend_Pdf_FileParserDataSource
getOffset()
getSize()
isBitSet(integer $bit, integer $bitField) : boolean
integer
Bit number to test (i.e. - 0-31)
integer
boolean
isParsed() : boolean
boolean
isScreened() : boolean
boolean
moveToOffset(integer $offset)
integer
Destination byte offset.
\Zend_Pdf_Exception |
---|
parse()
Must set $this->_isParsed to true if successful.
\Zend_Pdf_Exception |
---|
readBytes(integer $byteCount) : string
integer
Number of bytes to read.
\Zend_Pdf_Exception |
---|
string
readFixed(integer $mantissaBits, integer $fractionBits, integer $byteOrder = \Zend_Pdf_FileParser::BYTE_ORDER_BIG_ENDIAN
) : float
Common fixed-point sizes are 2.14 and 16.16.
Advances the offset by the number of bytes read. Throws an exception if an error occurs.
integer
Number of bits in the mantissa
integer
Number of bits in the fraction
integer
(optional) Big- or little-endian byte order. Use the BYTEORDER constants defined in {@link Zend_Pdf_FileParser}. If omitted, uses big-endian.
\Zend_Pdf_Exception |
---|
float
readInt(integer $size, integer $byteOrder = \Zend_Pdf_FileParser::BYTE_ORDER_BIG_ENDIAN
) : integer
Advances the offset by the number of bytes read. Throws an exception if an error occurs.
integer
Size of integer in bytes: 1-4
integer
(optional) Big- or little-endian byte order. Use the BYTEORDER constants defined in {@link Zend_Pdf_FileParser}. If omitted, uses big-endian.
\Zend_Pdf_Exception |
---|
integer
readStringMacRoman(integer $byteCount, string $characterSet = ''
) : string
You must supply the desired resulting character set.
Advances the offset by the number of bytes read. Throws an exception if an error occurs.
inherited_from | \Zend_Pdf_FileParser::readStringMacRoman() |
---|
integer
Number of bytes (characters) to return.
string
(optional) --Ignored--
\Zend_Pdf_Exception |
---|
string
readStringMacRoman(integer $byteCount, string $characterSet = ''
) : string
You must supply the desired resulting character set.
Advances the offset by the number of bytes read. Throws an exception if an error occurs.
integer
Number of bytes (characters) to return.
string
(optional) Desired resulting character set. You may use any character set supported by {@link iconv()}. If omitted, uses 'current locale'.
\Zend_Pdf_Exception |
---|
string
readStringPascal(string $characterSet= ''
, integer $lengthBytes= 1
) : string
The length of the Pascal string is determined by reading the length bytes which preceed the character data. You must supply the desired resulting character set.
Advances the offset by the number of bytes read. Throws an exception if an error occurs.
inherited_from | \Zend_Pdf_FileParser::readStringPascal() |
---|
string
(optional) --Ignored--
integer
(optional) Number of bytes that make up the length. Default is 1.
\Zend_Pdf_Exception |
---|
string
readStringPascal(string $characterSet= ''
, integer $lengthBytes= 1
) : string
The length of the Pascal string is determined by reading the length bytes which preceed the character data. You must supply the desired resulting character set.
Advances the offset by the number of bytes read. Throws an exception if an error occurs.
string
(optional) Desired resulting character set. You may use any character set supported by {@link iconv()}. If omitted, uses 'current locale'.
integer
(optional) Number of bytes that make up the length. Default is 1.
\Zend_Pdf_Exception |
---|
string
readStringUTF16(integer $byteCount, integer $byteOrder= \Zend_Pdf_FileParser::BYTE_ORDER_BIG_ENDIAN
, string $characterSet= ''
) : string
The byte order of the UTF-16 string must be specified. You must also supply the desired resulting character set.
Advances the offset by the number of bytes read. Throws an exception if an error occurs.
todo | Deal with to-dos in the parent method. |
---|---|
inherited_from | \Zend_Pdf_FileParser::readStringUTF16() |
integer
Number of bytes (characters * 2) to return.
integer
(optional) Big- or little-endian byte order. Use the BYTEORDER constants defined in {@link Zend_Pdf_FileParser}. If omitted, uses big-endian.
string
(optional) --Ignored--
\Zend_Pdf_Exception |
---|
string
readStringUTF16(integer $byteCount, integer $byteOrder= \Zend_Pdf_FileParser::BYTE_ORDER_BIG_ENDIAN
, string $characterSet= ''
) : string
The byte order of the UTF-16 string must be specified. You must also supply the desired resulting character set.
Advances the offset by the number of bytes read. Throws an exception if an error occurs.
todo | Consider changing $byteCount to a character count. They are not always equivalent (in the case of surrogates). |
---|---|
todo | Make $byteOrder optional if there is a byte-order mark (BOM) in the string being extracted. |
integer
Number of bytes (characters * 2) to return.
integer
(optional) Big- or little-endian byte order. Use the BYTEORDER constants defined in {@link Zend_Pdf_FileParser}. If omitted, uses big-endian.
string
(optional) Desired resulting character set. You may use any character set supported by {@link iconv()}. If omitted, uses 'current locale'.
\Zend_Pdf_Exception |
---|
string
readUInt(integer $size, integer $byteOrder = \Zend_Pdf_FileParser::BYTE_ORDER_BIG_ENDIAN
) : integer
Advances the offset by the number of bytes read. Throws an exception if an error occurs.
NOTE: If you ask for a 4-byte unsigned integer on a 32-bit machine, the resulting value WILL BE SIGNED because PHP uses signed integers internally for everything. To guarantee portability, be sure to use bitwise operators operators on large unsigned integers!
integer
Size of integer in bytes: 1-4
integer
(optional) Big- or little-endian byte order. Use the BYTEORDER constants defined in {@link Zend_Pdf_FileParser}. If omitted, uses big-endian.
\Zend_Pdf_Exception |
---|
integer
screen()
Must set $this->_isScreened to true if successful.
\Zend_Pdf_Exception |
---|
skipBytes(integer $byteCount)
integer
Number of bytes to skip.
\Zend_Pdf_Exception |
---|
writeDebug()
_debugLog(string $message)
The log message is a sprintf() style string and any number of arguments may accompany it as additional parameters.
string
$_dataSource : \Zend_Pdf_FileParserDataSource
null
$_isParsed : boolean
false
$_isScreened : boolean
false
$_debug : boolean
false
$_fontProperties : array
array()
BYTE_ORDER_BIG_ENDIAN = 1
BYTE_ORDER_LITTLE_ENDIAN = 0