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

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

82 lines 1.9 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
9 namespace FontLib\WOFF;
10
11 use FontLib\Table\DirectoryEntry;
12
13 /**
14 * WOFF font file.
15 *
16 * @package php-font-lib
17 *
18 * @property TableDirectoryEntry[] $directory
19 */
20 class File extends \FontLib\TrueType\File {
21 function parseHeader() {
22 if (!empty($this->header)) {
23 return;
24 }
25
26 $this->header = new Header($this);
27 $this->header->parse();
28 }
29
30 public function load($file) {
31 parent::load($file);
32
33 $this->parseTableEntries();
34 $dataOffset = $this->pos() + count($this->directory) * 20;
35
36 $fw = $this->getTempFile(false);
37 $fr = $this->f;
38
39 $this->f = $fw;
40 $offset = $this->header->encode();
41
42 foreach ($this->directory as $entry) {
43 // Read ...
44 $this->f = $fr;
45 $this->seek($entry->offset);
46 $data = $this->read($entry->length);
47
48 if ($entry->length < $entry->origLength) {
49 $data = (string) gzuncompress($data);
50 }
51
52 // Prepare data ...
53 $length = mb_strlen($data, '8bit');
54 $entry->length = $entry->origLength = $length;
55 $entry->offset = $dataOffset;
56
57 // Write ...
58 $this->f = $fw;
59
60 // Woff Entry
61 $this->seek($offset);
62 $offset += $this->write($entry->tag, 4); // tag
63 $offset += $this->writeUInt32($dataOffset); // offset
64 $offset += $this->writeUInt32($length); // length
65 $offset += $this->writeUInt32($length); // origLength
66 $offset += $this->writeUInt32(DirectoryEntry::computeChecksum($data)); // checksum
67
68 // Data
69 $this->seek($dataOffset);
70 $dataOffset += $this->write($data, $length);
71 }
72
73 $this->f = $fw;
74 $this->seek(0);
75
76 // Need to re-parse this, don't know why
77 $this->header = null;
78 $this->directory = array();
79 $this->parseTableEntries();
80 }
81 }
82