No Description

head.php 1.3KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. <?php
  2. /**
  3. * @package php-font-lib
  4. * @link https://github.com/PhenX/php-font-lib
  5. * @author Fabien Ménager <fabien.menager@gmail.com>
  6. * @license http://www.gnu.org/copyleft/lesser.html GNU Lesser General Public License
  7. */
  8. namespace FontLib\Table\Type;
  9. use FontLib\Table\Table;
  10. use Exception;
  11. /**
  12. * `head` font table.
  13. *
  14. * @package php-font-lib
  15. */
  16. class head extends Table {
  17. protected $def = array(
  18. "tableVersion" => self::Fixed,
  19. "fontRevision" => self::Fixed,
  20. "checkSumAdjustment" => self::uint32,
  21. "magicNumber" => self::uint32,
  22. "flags" => self::uint16,
  23. "unitsPerEm" => self::uint16,
  24. "created" => self::longDateTime,
  25. "modified" => self::longDateTime,
  26. "xMin" => self::FWord,
  27. "yMin" => self::FWord,
  28. "xMax" => self::FWord,
  29. "yMax" => self::FWord,
  30. "macStyle" => self::uint16,
  31. "lowestRecPPEM" => self::uint16,
  32. "fontDirectionHint" => self::int16,
  33. "indexToLocFormat" => self::int16,
  34. "glyphDataFormat" => self::int16,
  35. );
  36. protected function _parse() {
  37. parent::_parse();
  38. if ($this->data["magicNumber"] != 0x5F0F3CF5) {
  39. throw new Exception("Incorrect magic number (" . dechex($this->data["magicNumber"]) . ")");
  40. }
  41. }
  42. }