Font_Table

Generic font table.

Defined (1)

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

/lib/dompdf/lib/php-font-lib/classes/Font_Table.php  
  1. class Font_Table extends Font_Binary_Stream { 
  2. /** 
  3. * @var Font_Table_Directory_Entry 
  4. */ 
  5. protected $entry; 
  6. protected $def = array(); 
  7.  
  8. public $data; 
  9.  
  10. final public function __construct(Font_Table_Directory_Entry $entry) { 
  11. $this->entry = $entry; 
  12. $entry->setTable($this); 
  13.  
  14. /** 
  15. * @return Font_TrueType 
  16. */ 
  17. public function getFont() { 
  18. return $this->entry->getFont(); 
  19.  
  20. protected function _encode() { 
  21. if (empty($this->data)) { 
  22. Font::d(" >> Table is empty"); 
  23. return 0; 
  24.  
  25. return $this->getFont()->pack($this->def, $this->data); 
  26.  
  27. protected function _parse() { 
  28. $this->data = $this->getFont()->unpack($this->def); 
  29.  
  30. protected function _parseRaw() { 
  31. $this->data = $this->getFont()->read($this->entry->length); 
  32.  
  33. protected function _encodeRaw() { 
  34. return $this->getFont()->write($this->data, $this->entry->length); 
  35.  
  36. public function toHTML() { 
  37. return "<pre>".var_export($this->data, true)."</pre>";  
  38.  
  39. final public function encode() { 
  40. $this->entry->startWrite(); 
  41.  
  42. if (false && empty($this->def)) { 
  43. $length = $this->_encodeRaw(); 
  44. else { 
  45. $length = $this->_encode(); 
  46.  
  47. $this->entry->endWrite(); 
  48.  
  49. return $length; 
  50.  
  51. final public function parse() { 
  52. $this->entry->startRead(); 
  53.  
  54. if (false && empty($this->def)) { 
  55. $this->_parseRaw(); 
  56. else { 
  57. $this->_parse(); 
  58.  
  59. $this->entry->endRead();