PluginProbe
Yatra – Travel Booking & Tour Operator Software / 3.0.16
Yatra – Travel Booking & Tour Operator Software v3.0.16
3.0.16 3.0.15 3.0.14 3.0.14.1 3.0.14.2 3.0.12 3.0.13 3.0.11 3.0.10 3.0.9 3.0.8 3.0.7 3.0.6 3.0.5 3.0.5.1 3.0.4 3.0.3 3.0.2.9 3.0.2.7 3.0.2.8 3.0.2.6 trunk 1.0.0 2.0.0 2.0.1 All 84 releases
yatra / vendor / phenx / php-font-lib / src / FontLib / Table / Table.php

Table.php in Yatra – Travel Booking & Tour Operator Software 3.0.16, at vendor/phenx/php-font-lib/src/FontLib/Table/Table.php

93 lines 1.8 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 /**
3 * @package php-font-lib
4 * @link https://github.com/dompdf/php-font-lib
5 * @author Fabien Ménager <[email protected]>
6 * @license http://www.gnu.org/copyleft/lesser.html GNU Lesser General Public License
7 */
8 namespace FontLib\Table;
9
10 use FontLib\TrueType\File;
11 use FontLib\Font;
12 use FontLib\BinaryStream;
13
14 /**
15 * Generic font table.
16 *
17 * @package php-font-lib
18 */
19 class Table extends BinaryStream {
20 /**
21 * @var DirectoryEntry
22 */
23 protected $entry;
24 protected $def = array();
25
26 public $data;
27
28 final public function __construct(DirectoryEntry $entry) {
29 $this->entry = $entry;
30 $entry->setTable($this);
31 }
32
33 /**
34 * @return File
35 */
36 public function getFont() {
37 return $this->entry->getFont();
38 }
39
40 protected function _encode() {
41 if (empty($this->data)) {
42 Font::d(" >> Table is empty");
43
44 return 0;
45 }
46
47 return $this->getFont()->pack($this->def, $this->data);
48 }
49
50 protected function _parse() {
51 $this->data = $this->getFont()->unpack($this->def);
52 }
53
54 protected function _parseRaw() {
55 $this->data = $this->getFont()->read($this->entry->length);
56 }
57
58 protected function _encodeRaw() {
59 return $this->getFont()->write($this->data, $this->entry->length);
60 }
61
62 public function toHTML() {
63 return "<pre>" . var_export($this->data, true) . "</pre>";
64 }
65
66 final public function encode() {
67 $this->entry->startWrite();
68
69 if (false && empty($this->def)) {
70 $length = $this->_encodeRaw();
71 }
72 else {
73 $length = $this->_encode();
74 }
75
76 $this->entry->endWrite();
77
78 return $length;
79 }
80
81 final public function parse() {
82 $this->entry->startRead();
83
84 if (false && empty($this->def)) {
85 $this->_parseRaw();
86 }
87 else {
88 $this->_parse();
89 }
90
91 $this->entry->endRead();
92 }
93 }