font_header.cls.php 728 B

1234567891011121314151617181920212223242526272829303132333435
  1. <?php
  2. /**
  3. * @package php-font-lib
  4. * @link http://php-font-lib.googlecode.com/
  5. * @author Fabien Ménager <fabien.menager@gmail.com>
  6. * @license http://www.gnu.org/copyleft/lesser.html GNU Lesser General Public License
  7. * @version $Id$
  8. */
  9. /**
  10. * Font header container.
  11. *
  12. * @package php-font-lib
  13. */
  14. abstract class Font_Header extends Font_Binary_Stream {
  15. /**
  16. * @var Font_TrueType
  17. */
  18. protected $font;
  19. protected $def = array();
  20. public $data;
  21. public function __construct(Font_TrueType $font) {
  22. $this->font = $font;
  23. }
  24. public function encode(){
  25. return $this->font->pack($this->def, $this->data);
  26. }
  27. public function parse(){
  28. $this->data = $this->font->unpack($this->def);
  29. }
  30. }