You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

90 lines
2.4 KiB

11 years ago
9 years ago
11 years ago
10 years ago
11 years ago
9 years ago
11 years ago
  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-2015 Zend Technologies USA Inc. (http://www.zend.com)
  19. * @license http://framework.zend.com/license/new-bsd New BSD License
  20. * @version $Id$
  21. */
  22. /** Zend_Pdf_FileParser_Font_OpenType */
  23. // require_once 'Zend/Pdf/FileParser/Font/OpenType.php';
  24. /**
  25. * Parses an OpenType font file containing TrueType outlines.
  26. *
  27. * @package Zend_Pdf
  28. * @subpackage FileParser
  29. * @copyright Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com)
  30. * @license http://framework.zend.com/license/new-bsd New BSD License
  31. */
  32. class Zend_Pdf_FileParser_Font_OpenType_TrueType extends Zend_Pdf_FileParser_Font_OpenType
  33. {
  34. /**** Public Interface ****/
  35. /* Concrete Class Implementation */
  36. /**
  37. * Verifies that the font file actually contains TrueType outlines.
  38. *
  39. * @throws Zend_Pdf_Exception
  40. */
  41. public function screen()
  42. {
  43. if ($this->_isScreened) {
  44. return;
  45. }
  46. parent::screen();
  47. switch ($this->_readScalerType()) {
  48. case 0x00010000: // version 1.0 - Windows TrueType signature
  49. break;
  50. case 0x74727565: // 'true' - Macintosh TrueType signature
  51. break;
  52. default:
  53. // require_once 'Zend/Pdf/Exception.php';
  54. throw new Zend_Pdf_Exception('Not a TrueType font file',
  55. Zend_Pdf_Exception::WRONG_FONT_TYPE);
  56. }
  57. $this->fontType = Zend_Pdf_Font::TYPE_TRUETYPE;
  58. $this->_isScreened = true;
  59. }
  60. /**
  61. * Reads and parses the TrueType font data from the file on disk.
  62. *
  63. * @throws Zend_Pdf_Exception
  64. */
  65. public function parse()
  66. {
  67. if ($this->_isParsed) {
  68. return;
  69. }
  70. parent::parse();
  71. /* There is nothing additional to parse for TrueType fonts at this time.
  72. */
  73. $this->_isParsed = true;
  74. }
  75. }