PluginProbe
WCPOS – Point of Sale (POS) plugin for WooCommerce / 1.10.19
WCPOS – Point of Sale (POS) plugin for WooCommerce v1.10.19
1.10.19 1.10.18 1.10.17 1.10.16 1.10.15 1.10.13 1.10.14 1.10.12 1.10.11 1.10.10 1.10.9 1.10.8 untagged-3d9b7ccddc54df87c672 1.10.7 1.10.6 1.10.5 1.10.3 1.10.4 1.10.2 1.10.1 1.10.0 1.9.17 1.9.15 1.9.16 1.9.14 All 163 releases
woocommerce-pos / vendor_prefixed / dompdf / php-font-lib / src / FontLib / WOFF / File.php

File.php in WCPOS – Point of Sale (POS) plugin for WooCommerce 1.10.19, at vendor_prefixed/dompdf/php-font-lib/src/FontLib/WOFF/File.php

75 lines 2.2 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 /**
4 * @package php-font-lib
5 * @link https://github.com/dompdf/php-font-lib
6 * @license http://www.gnu.org/copyleft/lesser.html GNU Lesser General Public License
7 */
8 namespace WCPOS\Vendor\FontLib\WOFF;
9
10 use WCPOS\Vendor\FontLib\Table\DirectoryEntry;
11 /**
12 * WOFF font file.
13 *
14 * @package php-font-lib
15 *
16 * @property TableDirectoryEntry[] $directory
17 */
18 class File extends \WCPOS\Vendor\FontLib\TrueType\File
19 {
20 function parseHeader()
21 {
22 if (!empty($this->header)) {
23 return;
24 }
25 $this->header = new Header($this);
26 $this->header->parse();
27 }
28 public function load($file)
29 {
30 parent::load($file);
31 $this->parseTableEntries();
32 $dataOffset = $this->pos() + \count($this->directory) * 20;
33 $fw = $this->getTempFile(\false);
34 $fr = $this->f;
35 $this->f = $fw;
36 $offset = $this->header->encode();
37 foreach ($this->directory as $entry) {
38 // Read ...
39 $this->f = $fr;
40 $this->seek($entry->offset);
41 $data = $this->read($entry->length);
42 if ($entry->length < $entry->origLength) {
43 $data = (string) \gzuncompress($data);
44 }
45 // Prepare data ...
46 $length = \mb_strlen($data, '8bit');
47 $entry->length = $entry->origLength = $length;
48 $entry->offset = $dataOffset;
49 // Write ...
50 $this->f = $fw;
51 // Woff Entry
52 $this->seek($offset);
53 $offset += $this->write($entry->tag, 4);
54 // tag
55 $offset += $this->writeUInt32($dataOffset);
56 // offset
57 $offset += $this->writeUInt32($length);
58 // length
59 $offset += $this->writeUInt32($length);
60 // origLength
61 $offset += $this->writeUInt32(DirectoryEntry::computeChecksum($data));
62 // checksum
63 // Data
64 $this->seek($dataOffset);
65 $dataOffset += $this->write($data, $length);
66 }
67 $this->f = $fw;
68 $this->seek(0);
69 // Need to re-parse this, don't know why
70 $this->header = null;
71 $this->directory = array();
72 $this->parseTableEntries();
73 }
74 }
75