Font_EOT_Header

TrueType font file header.

Defined (1)

The class is defined in the following location(s).

/lib/dompdf/lib/php-font-lib/classes/Font_EOT_Header.php  
  1. class Font_EOT_Header extends Font_Header { 
  2. protected $def = array( 
  3. "format" => self::uint32,  
  4. "numTables" => self::uint16,  
  5. "searchRange" => self::uint16,  
  6. "entrySelector" => self::uint16,  
  7. "rangeShift" => self::uint16,  
  8. ); 
  9.  
  10. public function parse() { 
  11. $font = $this->font; 
  12.  
  13. $this->data = $font->unpack(array( 
  14. "EOTSize" => self::uint32,  
  15. "FontDataSize" => self::uint32,  
  16. "Version" => self::uint32,  
  17. "Flags" => self::uint32,  
  18. "FontPANOSE" => array(self::uint8, 10),  
  19. "Charset" => self::uint8,  
  20. "Italic" => self::uint8,  
  21. "Weight" => self::uint32,  
  22. "fsType" => self::uint16,  
  23. "MagicNumber" => self::uint16,  
  24. "UnicodeRange1" => self::uint32,  
  25. "UnicodeRange2" => self::uint32,  
  26. "UnicodeRange3" => self::uint32,  
  27. "UnicodeRange4" => self::uint32,  
  28. "CodePageRange1" => self::uint32,  
  29. "CodePageRange2" => self::uint32,  
  30. "CheckSumAdjustment" => self::uint32,  
  31. "Reserved1" => self::uint32,  
  32. "Reserved2" => self::uint32,  
  33. "Reserved3" => self::uint32,  
  34. "Reserved4" => self::uint32,  
  35. )); 
  36.  
  37. $this->data["Padding1"] = $font->readUInt16(); 
  38. $this->readString("FamilyName"); 
  39.  
  40. $this->data["Padding2"] = $font->readUInt16(); 
  41. $this->readString("StyleName"); 
  42.  
  43. $this->data["Padding3"] = $font->readUInt16(); 
  44. $this->readString("VersionName"); 
  45.  
  46. $this->data["Padding4"] = $font->readUInt16(); 
  47. $this->readString("FullName"); 
  48.  
  49. switch ($this->data["Version"]) { 
  50. default: 
  51. throw new Exception("Unknown EOT version ".$this->data["Version"]); 
  52.  
  53. case 0x00010000: 
  54. // Nothing to do more 
  55. break; 
  56.  
  57. case 0x00020001: 
  58. $this->data["Padding5"] = $font->readUInt16(); 
  59. $this->readString("RootString"); 
  60. break; 
  61.  
  62. case 0x00020002: 
  63. $this->data["Padding5"] = $font->readUInt16(); 
  64. $this->readString("RootString"); 
  65.  
  66. $this->data["RootStringCheckSum"] = $font->readUInt32(); 
  67. $this->data["EUDCCodePage"] = $font->readUInt32(); 
  68.  
  69. $this->data["Padding6"] = $font->readUInt16(); 
  70. $this->readString("Signature"); 
  71.  
  72. $this->data["EUDCFlags"] = $font->readUInt32(); 
  73. $this->data["EUDCFontSize"] = $font->readUInt32(); 
  74. break; 
  75.  
  76. if (!empty($this->data["RootString"])) { 
  77. $this->data["RootString"] = explode("\0", $this->data["RootString"]); 
  78.  
  79. private function readString($name) { 
  80. $font = $this->font; 
  81. $size = $font->readUInt16(); 
  82.  
  83. $this->data["{$name}Size"] = $size; 
  84. $this->data[$name] = Font::UTF16ToUTF8($font->read($size)); 
  85.  
  86. public function encode() { 
  87. //return $this->font->pack($this->def, $this->data);