font_eot.cls.php 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  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. require_once dirname(__FILE__)."/font_truetype.cls.php";
  10. /**
  11. * EOT font file.
  12. *
  13. * @package php-font-lib
  14. */
  15. class Font_EOT extends Font_TrueType {
  16. private $origF;
  17. private $fileOffset = 0;
  18. public $header;
  19. function parseHeader(){
  20. $this->header = $this->unpack(array(
  21. "EOTSize" => self::uint32,
  22. "FontDataSize" => self::uint32,
  23. "Version" => self::uint32,
  24. "Flags" => self::uint32,
  25. ));
  26. $this->header["FontPANOSE"] = $this->read(10);
  27. $this->header += $this->unpack(array(
  28. "Charset" => self::uint8,
  29. "Italic" => self::uint8,
  30. "Weight" => self::uint32,
  31. "fsType" => self::uint16,
  32. "MagicNumber" => self::uint16,
  33. "UnicodeRange1" => self::uint32,
  34. "UnicodeRange2" => self::uint32,
  35. "UnicodeRange3" => self::uint32,
  36. "UnicodeRange4" => self::uint32,
  37. "CodePageRange1" => self::uint32,
  38. "CodePageRange2" => self::uint32,
  39. "CheckSumAdjustment" => self::uint32,
  40. "Reserved1" => self::uint32,
  41. "Reserved2" => self::uint32,
  42. "Reserved3" => self::uint32,
  43. "Reserved4" => self::uint32,
  44. "Padding1" => self::uint16,
  45. "FamilyNameSize" => self::uint16,
  46. ));
  47. }
  48. function parse() {
  49. exit("EOT not supported yet");
  50. }
  51. public function readUInt16() {
  52. $a = unpack('vv', $this->read(2));
  53. return $a['v'];
  54. }
  55. public function readUInt32() {
  56. $a = unpack('VV', $this->read(4));
  57. return $a['V'];
  58. }
  59. }