import v2.0.0.0_RC3 | 2012-07-01
https://github.com/lucanos/CommunityID -> http://www.itadmins.net/archives/357
This commit is contained in:
@ -17,16 +17,12 @@
|
||||
* @subpackage FileParser
|
||||
* @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
* @version $Id: OpenType.php 16541 2009-07-07 06:59:03Z bkarwin $
|
||||
* @version $Id: OpenType.php 18993 2009-11-15 17:09:16Z alexander $
|
||||
*/
|
||||
|
||||
/** Zend_Pdf_FileParser_Font */
|
||||
require_once 'Zend/Pdf/FileParser/Font.php';
|
||||
|
||||
/** Zend_Pdf_Cmap */
|
||||
require_once 'Zend/Pdf/Cmap.php';
|
||||
|
||||
|
||||
/**
|
||||
* Abstract base class for OpenType font file parsers.
|
||||
*
|
||||
@ -166,6 +162,7 @@ abstract class Zend_Pdf_FileParser_Font_OpenType extends Zend_Pdf_FileParser_Fon
|
||||
* are defined, so use 50 as a practical limit.
|
||||
*/
|
||||
if (($tableCount < 7) || ($tableCount > 50)) {
|
||||
require_once 'Zend/Pdf/Exception.php';
|
||||
throw new Zend_Pdf_Exception('Table count not within expected range',
|
||||
Zend_Pdf_Exception::BAD_TABLE_COUNT);
|
||||
}
|
||||
@ -196,10 +193,12 @@ abstract class Zend_Pdf_FileParser_Font_OpenType extends Zend_Pdf_FileParser_Fon
|
||||
*/
|
||||
$fileSize = $this->_dataSource->getSize();
|
||||
if (($tableOffset < 0) || ($tableOffset > $fileSize)) {
|
||||
require_once 'Zend/Pdf/Exception.php';
|
||||
throw new Zend_Pdf_Exception("Table offset ($tableOffset) not within expected range",
|
||||
Zend_Pdf_Exception::INDEX_OUT_OF_RANGE);
|
||||
}
|
||||
if (($tableLength < 0) || (($tableOffset + $tableLength) > $fileSize)) {
|
||||
require_once 'Zend/Pdf/Exception.php';
|
||||
throw new Zend_Pdf_Exception("Table length ($tableLength) not within expected range",
|
||||
Zend_Pdf_Exception::INDEX_OUT_OF_RANGE);
|
||||
}
|
||||
@ -232,6 +231,7 @@ abstract class Zend_Pdf_FileParser_Font_OpenType extends Zend_Pdf_FileParser_Fon
|
||||
|
||||
$magicNumber = $this->readUInt(4);
|
||||
if ($magicNumber != 0x5f0f3cf5) {
|
||||
require_once 'Zend/Pdf/Exception.php';
|
||||
throw new Zend_Pdf_Exception('Wrong magic number. Expected: 0x5f0f3cf5; actual: '
|
||||
. sprintf('%x', $magicNumber),
|
||||
Zend_Pdf_Exception::BAD_MAGIC_NUMBER);
|
||||
@ -292,6 +292,7 @@ abstract class Zend_Pdf_FileParser_Font_OpenType extends Zend_Pdf_FileParser_Fon
|
||||
*/
|
||||
$tableFormat = $this->readUInt(2);
|
||||
if ($tableFormat != 0) {
|
||||
require_once 'Zend/Pdf/Exception.php';
|
||||
throw new Zend_Pdf_Exception("Unable to read format $tableFormat table",
|
||||
Zend_Pdf_Exception::DONT_UNDERSTAND_TABLE_VERSION);
|
||||
}
|
||||
@ -492,6 +493,7 @@ abstract class Zend_Pdf_FileParser_Font_OpenType extends Zend_Pdf_FileParser_Fon
|
||||
protected function _parseOs2Table()
|
||||
{
|
||||
if (! $this->numberHMetrics) {
|
||||
require_once 'Zend/Pdf/Exception.php';
|
||||
throw new Zend_Pdf_Exception("hhea table must be parsed prior to calling this method",
|
||||
Zend_Pdf_Exception::PARSED_OUT_OF_ORDER);
|
||||
}
|
||||
@ -501,6 +503,7 @@ abstract class Zend_Pdf_FileParser_Font_OpenType extends Zend_Pdf_FileParser_Fon
|
||||
} catch (Zend_Pdf_Exception $exception) {
|
||||
/* This table is not always present. If missing, use default values.
|
||||
*/
|
||||
require_once 'Zend/Pdf/Exception.php';
|
||||
if ($exception->getCode() == Zend_Pdf_Exception::REQUIRED_TABLE_NOT_FOUND) {
|
||||
$this->_debugLog('No OS/2 table found. Using default values');
|
||||
$this->fontWeight = Zend_Pdf_Font::WEIGHT_NORMAL;
|
||||
@ -547,6 +550,7 @@ abstract class Zend_Pdf_FileParser_Font_OpenType extends Zend_Pdf_FileParser_Fon
|
||||
*/
|
||||
$tableVersion = $this->readUInt(2);
|
||||
if (($tableVersion < 0) || ($tableVersion > 3)) {
|
||||
require_once 'Zend/Pdf/Exception.php';
|
||||
throw new Zend_Pdf_Exception("Unable to read version $tableVersion table",
|
||||
Zend_Pdf_Exception::DONT_UNDERSTAND_TABLE_VERSION);
|
||||
}
|
||||
@ -728,6 +732,7 @@ abstract class Zend_Pdf_FileParser_Font_OpenType extends Zend_Pdf_FileParser_Fon
|
||||
$this->_jumpToTable('hmtx');
|
||||
|
||||
if (! $this->numberHMetrics) {
|
||||
require_once 'Zend/Pdf/Exception.php';
|
||||
throw new Zend_Pdf_Exception("hhea table must be parsed prior to calling this method",
|
||||
Zend_Pdf_Exception::PARSED_OUT_OF_ORDER);
|
||||
}
|
||||
@ -735,6 +740,7 @@ abstract class Zend_Pdf_FileParser_Font_OpenType extends Zend_Pdf_FileParser_Fon
|
||||
/* We only understand version 0 tables.
|
||||
*/
|
||||
if ($this->metricDataFormat != 0) {
|
||||
require_once 'Zend/Pdf/Exception.php';
|
||||
throw new Zend_Pdf_Exception("Unable to read format $this->metricDataFormat table.",
|
||||
Zend_Pdf_Exception::DONT_UNDERSTAND_TABLE_VERSION);
|
||||
}
|
||||
@ -787,6 +793,7 @@ abstract class Zend_Pdf_FileParser_Font_OpenType extends Zend_Pdf_FileParser_Fon
|
||||
*/
|
||||
$tableVersion = $this->readUInt(2);
|
||||
if ($tableVersion != 0) {
|
||||
require_once 'Zend/Pdf/Exception.php';
|
||||
throw new Zend_Pdf_Exception("Unable to read version $tableVersion table",
|
||||
Zend_Pdf_Exception::DONT_UNDERSTAND_TABLE_VERSION);
|
||||
}
|
||||
@ -915,6 +922,7 @@ abstract class Zend_Pdf_FileParser_Font_OpenType extends Zend_Pdf_FileParser_Fon
|
||||
break;
|
||||
}
|
||||
if ($cmapType == -1) {
|
||||
require_once 'Zend/Pdf/Exception.php';
|
||||
throw new Zend_Pdf_Exception('Unable to find usable cmap table',
|
||||
Zend_Pdf_Exception::CANT_FIND_GOOD_CMAP);
|
||||
}
|
||||
@ -925,6 +933,8 @@ abstract class Zend_Pdf_FileParser_Font_OpenType extends Zend_Pdf_FileParser_Fon
|
||||
$cmapType, $cmapOffset, $cmapLength);
|
||||
$this->moveToOffset($cmapOffset);
|
||||
$cmapData = $this->readBytes($cmapLength);
|
||||
|
||||
require_once 'Zend/Pdf/Cmap.php';
|
||||
$this->cmap = Zend_Pdf_Cmap::cmapWithTypeData($cmapType, $cmapData);
|
||||
}
|
||||
|
||||
@ -964,10 +974,12 @@ abstract class Zend_Pdf_FileParser_Font_OpenType extends Zend_Pdf_FileParser_Fon
|
||||
break;
|
||||
|
||||
case 0x74797031: // 'typ1'
|
||||
require_once 'Zend/Pdf/Exception.php';
|
||||
throw new Zend_Pdf_Exception('Unsupported font type: PostScript in sfnt wrapper',
|
||||
Zend_Pdf_Exception::WRONG_FONT_TYPE);
|
||||
|
||||
default:
|
||||
require_once 'Zend/Pdf/Exception.php';
|
||||
throw new Zend_Pdf_Exception('Not an OpenType font file',
|
||||
Zend_Pdf_Exception::WRONG_FONT_TYPE);
|
||||
}
|
||||
@ -984,6 +996,7 @@ abstract class Zend_Pdf_FileParser_Font_OpenType extends Zend_Pdf_FileParser_Fon
|
||||
protected function _jumpToTable($tableName)
|
||||
{
|
||||
if (empty($this->_tableDirectory[$tableName])) { // do not allow NULL or zero
|
||||
require_once 'Zend/Pdf/Exception.php';
|
||||
throw new Zend_Pdf_Exception("Required table '$tableName' not found!",
|
||||
Zend_Pdf_Exception::REQUIRED_TABLE_NOT_FOUND);
|
||||
}
|
||||
@ -1005,6 +1018,7 @@ abstract class Zend_Pdf_FileParser_Font_OpenType extends Zend_Pdf_FileParser_Fon
|
||||
{
|
||||
$tableVersion = $this->readFixed(16, 16);
|
||||
if (($tableVersion < $minVersion) || ($tableVersion > $maxVersion)) {
|
||||
require_once 'Zend/Pdf/Exception.php';
|
||||
throw new Zend_Pdf_Exception("Unable to read version $tableVersion table",
|
||||
Zend_Pdf_Exception::DONT_UNDERSTAND_TABLE_VERSION);
|
||||
}
|
||||
|
@ -17,13 +17,13 @@
|
||||
* @subpackage FileParser
|
||||
* @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
* @version $Id: TrueType.php 16541 2009-07-07 06:59:03Z bkarwin $
|
||||
* @version $Id: TrueType.php 18993 2009-11-15 17:09:16Z alexander $
|
||||
*/
|
||||
|
||||
|
||||
/** Zend_Pdf_FileParser_Font_OpenType */
|
||||
require_once 'Zend/Pdf/FileParser/Font/OpenType.php';
|
||||
|
||||
|
||||
/**
|
||||
* Parses an OpenType font file containing TrueType outlines.
|
||||
*
|
||||
@ -60,6 +60,7 @@ class Zend_Pdf_FileParser_Font_OpenType_TrueType extends Zend_Pdf_FileParser_Fon
|
||||
break;
|
||||
|
||||
default:
|
||||
require_once 'Zend/Pdf/Exception.php';
|
||||
throw new Zend_Pdf_Exception('Not a TrueType font file',
|
||||
Zend_Pdf_Exception::WRONG_FONT_TYPE);
|
||||
}
|
||||
|
Reference in New Issue
Block a user