fontType = Zend_Pdf_Font::TYPE_UNKNOWN; } /* Accessors */ /** * Get handler * * @param string $property * @return mixed */ public function __get($property) { if (isset($this->_fontProperties[$property])) { return $this->_fontProperties[$property]; } else { return null; } } /* NOTE: The set handler is defined below in the internal methods group. */ /* Parser Methods */ /** * Reads the Unicode UTF-16-encoded string from the binary file at the * current offset location. Overridden to fix return character set at UTF-16BE. * * @todo Deal with to-dos in the parent method. * * @param integer $byteCount Number of bytes (characters * 2) to return. * @param integer $byteOrder (optional) Big- or little-endian byte order. * Use the BYTE_ORDER_ constants defined in {@link Zend_Pdf_FileParser}. If * omitted, uses big-endian. * @param string $characterSet (optional) --Ignored-- * @return string * @throws Zend_Pdf_Exception */ public function readStringUTF16($byteCount, $byteOrder = Zend_Pdf_FileParser::BYTE_ORDER_BIG_ENDIAN, $characterSet = '') { return parent::readStringUTF16($byteCount, $byteOrder, 'UTF-16BE'); } /** * Reads the Mac Roman-encoded string from the binary file at the current * offset location. Overridden to fix return character set at UTF-16BE. * * @param integer $byteCount Number of bytes (characters) to return. * @param string $characterSet (optional) --Ignored-- * @return string * @throws Zend_Pdf_Exception */ public function readStringMacRoman($byteCount, $characterSet = '') { return parent::readStringMacRoman($byteCount, 'UTF-16BE'); } /** * Reads the Pascal string from the binary file at the current offset * location. Overridden to fix return character set at UTF-16BE. * * @param string $characterSet (optional) --Ignored-- * @param integer $lengthBytes (optional) Number of bytes that make up the * length. Default is 1. * @return string * @throws Zend_Pdf_Exception */ public function readStringPascal($characterSet = '', $lengthBytes = 1) { return parent::readStringPascal('UTF-16BE'); } /* Utility Methods */ /** * Writes the entire font properties array to STDOUT. Used only for debugging. */ public function writeDebug() { print_r($this->_fontProperties); } /**** Internal Methods ****/ /* Internal Accessors */ /** * Set handler * * NOTE: This method is protected. Other classes may freely interrogate * the font properties, but only this and its subclasses may set them. * * @param string $property * @param mixed $value */ public function __set($property, $value) { if ($value === null) { unset($this->_fontProperties[$property]); } else { $this->_fontProperties[$property] = $value; } } /* Internal Utility Methods */ /** * If debug logging is enabled, writes the log message. * * The log message is a sprintf() style string and any number of arguments * may accompany it as additional parameters. * * @param string $message * @param mixed (optional, multiple) Additional arguments */ protected function _debugLog($message) { if (! $this->_debug) { return; } if (func_num_args() > 1) { $args = func_get_args(); $message = array_shift($args); $message = vsprintf($message, $args); } // require_once 'Zend/Log.php'; $logger = new Zend_Log(); $logger->log($message, Zend_Log::DEBUG); } }