PluginProbe
Easy Invoice – Invoice Generator, PDF Quotes & Payments / 2.4.4
Easy Invoice – Invoice Generator, PDF Quotes & Payments v2.4.4
2.4.3 2.4.4 2.4.2 2.4.0 2.4.1 2.3.8 2.3.7 2.3.6 2.3.5 2.3.4 2.3.3 2.3.2 2.3.1 2.2.0 2.1.21 2.1.20 2.1.19 2.1.18 2.1.0 2.1.1 2.1.10 2.1.11 2.1.12 2.1.13 2.1.14 All 60 releases
easy-invoice / vendor / dompdf / php-font-lib / src / FontLib / Table / Table.php

Table.php in Easy Invoice – Invoice Generator, PDF Quotes & Payments 2.4.4, at vendor/dompdf/php-font-lib/src/FontLib/Table/Table.php

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