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 / EOT / File.php

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

159 lines 3.3 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
8 namespace FontLib\EOT;
9
10 /**
11 * EOT font file.
12 *
13 * @package php-font-lib
14 */
15 class File extends \FontLib\TrueType\File {
16 const TTEMBED_SUBSET = 0x00000001;
17 const TTEMBED_TTCOMPRESSED = 0x00000004;
18 const TTEMBED_FAILIFVARIATIONSIMULATED = 0x00000010;
19 const TTMBED_EMBEDEUDC = 0x00000020;
20 const TTEMBED_VALIDATIONTESTS = 0x00000040; // Deprecated
21 const TTEMBED_WEBOBJECT = 0x00000080;
22 const TTEMBED_XORENCRYPTDATA = 0x10000000;
23
24 /**
25 * @var Header
26 */
27 public $header;
28
29 function parseHeader() {
30 if (!empty($this->header)) {
31 return;
32 }
33
34 $this->header = new Header($this);
35 $this->header->parse();
36 }
37
38 function parse() {
39 $this->parseHeader();
40
41 $flags = $this->header->data["Flags"];
42
43 if ($flags & self::TTEMBED_TTCOMPRESSED) {
44 $mtx_version = $this->readUInt8();
45 $mtx_copy_limit = $this->readUInt8() << 16 | $this->readUInt8() << 8 | $this->readUInt8();
46 $mtx_offset_1 = $this->readUInt8() << 16 | $this->readUInt8() << 8 | $this->readUInt8();
47 $mtx_offset_2 = $this->readUInt8() << 16 | $this->readUInt8() << 8 | $this->readUInt8();
48 /*
49 var_dump("$mtx_version $mtx_copy_limit $mtx_offset_1 $mtx_offset_2");
50
51 $pos = $this->pos();
52 $size = $mtx_offset_1 - $pos;
53 var_dump("pos: $pos");
54 var_dump("size: $size");*/
55 }
56
57 if ($flags & self::TTEMBED_XORENCRYPTDATA) {
58 // Process XOR
59 }
60 // TODO Read font data ...
61 }
62
63 /**
64 * Little endian version of the read method
65 *
66 * @param int $n The number of bytes to read
67 *
68 * @return string
69 */
70 public function read($n) {
71 if ($n < 1) {
72 return "";
73 }
74
75 $string = (string) fread($this->f, $n);
76 $chunks = mb_str_split($string, 2, '8bit');
77 $chunks = array_map("strrev", $chunks);
78 return implode("", $chunks);
79 }
80
81 public function readUInt32() {
82 $uint32 = parent::readUInt32();
83
84 return $uint32 >> 16 & 0x0000FFFF | $uint32 << 16 & 0xFFFF0000;
85 }
86
87 /**
88 * Get font copyright
89 *
90 * @return string|null
91 */
92 function getFontCopyright() {
93 return null;
94 }
95
96 /**
97 * Get font name
98 *
99 * @return string|null
100 */
101 function getFontName() {
102 return $this->header->data["FamilyName"];
103 }
104
105 /**
106 * Get font subfamily
107 *
108 * @return string|null
109 */
110 function getFontSubfamily() {
111 return $this->header->data["StyleName"];
112 }
113
114 /**
115 * Get font subfamily ID
116 *
117 * @return string|null
118 */
119 function getFontSubfamilyID() {
120 return $this->header->data["StyleName"];
121 }
122
123 /**
124 * Get font full name
125 *
126 * @return string|null
127 */
128 function getFontFullName() {
129 return $this->header->data["FullName"];
130 }
131
132 /**
133 * Get font version
134 *
135 * @return string|null
136 */
137 function getFontVersion() {
138 return $this->header->data["VersionName"];
139 }
140
141 /**
142 * Get font weight
143 *
144 * @return string|null
145 */
146 function getFontWeight() {
147 return $this->header->data["Weight"];
148 }
149
150 /**
151 * Get font Postscript name
152 *
153 * @return string|null
154 */
155 function getFontPostscriptName() {
156 return null;
157 }
158 }
159