Font_Table_post

`post` font table.

Defined (1)

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

/lib/dompdf/lib/php-font-lib/classes/Font_Table_post.php  
  1. class Font_Table_post extends Font_Table { 
  2. protected $def = array( 
  3. "format" => self::Fixed,  
  4. "italicAngle" => self::Fixed,  
  5. "underlinePosition" => self::FWord,  
  6. "underlineThickness" => self::FWord,  
  7. "isFixedPitch" => self::uint32,  
  8. "minMemType42" => self::uint32,  
  9. "maxMemType42" => self::uint32,  
  10. "minMemType1" => self::uint32,  
  11. "maxMemType1" => self::uint32,  
  12. ); 
  13.  
  14. protected function _parse() { 
  15. $font = $this->getFont(); 
  16. $data = $font->unpack($this->def); 
  17.  
  18. $names = array(); 
  19.  
  20. switch($data["format"]) { 
  21. case 1: 
  22. $names = Font_TrueType::$macCharNames; 
  23. break; 
  24.  
  25. case 2: 
  26. $data["numberOfGlyphs"] = $font->readUInt16(); 
  27.  
  28. $glyphNameIndex = array(); 
  29. for($i = 0; $i < $data["numberOfGlyphs"]; $i++) { 
  30. $glyphNameIndex[] = $font->readUInt16(); 
  31.  
  32. $data["glyphNameIndex"] = $glyphNameIndex; 
  33.  
  34. $namesPascal = array(); 
  35. for($i = 0; $i < $data["numberOfGlyphs"]; $i++) { 
  36. $len = $font->readUInt8(); 
  37. $namesPascal[] = $font->read($len); 
  38.  
  39. foreach($glyphNameIndex as $g => $index) { 
  40. if ($index < 258) { 
  41. $names[$g] = Font_TrueType::$macCharNames[$index]; 
  42. else { 
  43. $names[$g] = $namesPascal[$index - 258]; 
  44.  
  45. break; 
  46.  
  47. case 2.5: 
  48. // TODO 
  49. break; 
  50.  
  51. case 3: 
  52. // nothing 
  53. break; 
  54.  
  55. case 4: 
  56. // TODO 
  57. break; 
  58.  
  59. $data["names"] = $names; 
  60.  
  61. $this->data = $data; 
  62.  
  63. function _encode() { 
  64. $font = $this->getFont(); 
  65. $data = $this->data; 
  66. $data["format"] = 3; 
  67.  
  68. $length = $font->pack($this->def, $data); 
  69.  
  70. return $length; 
  71.  
  72. /** 
  73. $subset = $font->getSubset(); 
  74.  
  75. switch($data["format"]) { 
  76. case 1: 
  77. // nothing to do 
  78. break; 
  79.  
  80. case 2: 
  81. $old_names = $data["names"]; 
  82.  
  83. $glyphNameIndex = range(0, count($subset)); 
  84.  
  85. $names = array(); 
  86. foreach($subset as $gid) { 
  87. $names[] = $data["names"][$data["glyphNameIndex"][$gid]]; 
  88.  
  89. $numberOfGlyphs = count($names); 
  90. $length += $font->writeUInt16($numberOfGlyphs); 
  91.  
  92. foreach($glyphNameIndex as $gni) { 
  93. $length += $font->writeUInt16($gni); 
  94.  
  95. //$names = array_slice($names, 257); 
  96. foreach($names as $name) { 
  97. $len = strlen($name); 
  98. $length += $font->writeUInt8($len); 
  99. $length += $font->write($name, $len); 
  100.  
  101. break; 
  102.  
  103. case 2.5: 
  104. // TODO 
  105. break; 
  106.  
  107. case 3: 
  108. // nothing 
  109. break; 
  110.  
  111. case 4: 
  112. // TODO 
  113. break; 
  114.  
  115. return $length;*/