/framework/vendor/zend/Zend/Pdf/FileParser/Font/OpenType/TrueType.php
PHP | 90 lines | 32 code | 15 blank | 43 comment | 3 complexity | 7d750f4a0ffc2ea49046ec7245f322cd MD5 | raw file
1<?php 2/** 3 * Zend Framework 4 * 5 * LICENSE 6 * 7 * This source file is subject to the new BSD license that is bundled 8 * with this package in the file LICENSE.txt. 9 * It is also available through the world-wide-web at this URL: 10 * http://framework.zend.com/license/new-bsd 11 * If you did not receive a copy of the license and are unable to 12 * obtain it through the world-wide-web, please send an email 13 * to license@zend.com so we can send you a copy immediately. 14 * 15 * @category Zend 16 * @package Zend_Pdf 17 * @subpackage FileParser 18 * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) 19 * @license http://framework.zend.com/license/new-bsd New BSD License 20 * @version $Id: TrueType.php 20096 2010-01-06 02:05:09Z bkarwin $ 21 */ 22 23 24/** Zend_Pdf_FileParser_Font_OpenType */ 25require_once 'Zend/Pdf/FileParser/Font/OpenType.php'; 26 27/** 28 * Parses an OpenType font file containing TrueType outlines. 29 * 30 * @package Zend_Pdf 31 * @subpackage FileParser 32 * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) 33 * @license http://framework.zend.com/license/new-bsd New BSD License 34 */ 35class Zend_Pdf_FileParser_Font_OpenType_TrueType extends Zend_Pdf_FileParser_Font_OpenType 36{ 37 /**** Public Interface ****/ 38 39 40 /* Concrete Class Implementation */ 41 42 /** 43 * Verifies that the font file actually contains TrueType outlines. 44 * 45 * @throws Zend_Pdf_Exception 46 */ 47 public function screen() 48 { 49 if ($this->_isScreened) { 50 return; 51 } 52 53 parent::screen(); 54 55 switch ($this->_readScalerType()) { 56 case 0x00010000: // version 1.0 - Windows TrueType signature 57 break; 58 59 case 0x74727565: // 'true' - Macintosh TrueType signature 60 break; 61 62 default: 63 require_once 'Zend/Pdf/Exception.php'; 64 throw new Zend_Pdf_Exception('Not a TrueType font file', 65 Zend_Pdf_Exception::WRONG_FONT_TYPE); 66 } 67 68 $this->fontType = Zend_Pdf_Font::TYPE_TRUETYPE; 69 $this->_isScreened = true; 70 } 71 72 /** 73 * Reads and parses the TrueType font data from the file on disk. 74 * 75 * @throws Zend_Pdf_Exception 76 */ 77 public function parse() 78 { 79 if ($this->_isParsed) { 80 return; 81 } 82 83 parent::parse(); 84 85 /* There is nothing additional to parse for TrueType fonts at this time. 86 */ 87 88 $this->_isParsed = true; 89 } 90}