+
$g
+
$char
+
$name
+ ";
+
+ if ($type == "composite") {
+ foreach ($glyph->getGlyphIDs() as $_id) {
+ $s .= "
$_id ";
+ }
+ }
+
+ $s .= "
+
+
+ ";
+ }
+
+ return $s;
+ }
+
+
+ protected function _encode() {
+ $font = $this->getFont();
+ $subset = $font->getSubset();
+ $data = $this->data;
+
+ $loca = array();
+
+ $length = 0;
+ foreach ($subset as $gid) {
+ $loca[] = $length;
+
+ $bytes = $data[$gid]->encode();
+
+ $pad = 0;
+ $mod = $bytes % 4;
+ if ($mod != 0) {
+ $pad = 4 - $mod;
+ $font->write(str_pad("", $pad, "\0"), $pad);
+ }
+ $length += $bytes + $pad;
+ }
+
+ $loca[] = $length; // dummy loca
+ $font->getTableObject("loca")->data = $loca;
+
+ return $length;
+ }
+}
\ No newline at end of file
diff --git a/app/libs/dompdf/vendor/dompdf/php-font-lib/src/FontLib/Table/Type/head.php b/app/libs/dompdf/vendor/dompdf/php-font-lib/src/FontLib/Table/Type/head.php
new file mode 100644
index 0000000..ce5a3a4
--- /dev/null
+++ b/app/libs/dompdf/vendor/dompdf/php-font-lib/src/FontLib/Table/Type/head.php
@@ -0,0 +1,50 @@
+ self::Fixed,
+ "fontRevision" => self::Fixed,
+ "checkSumAdjustment" => self::uint32,
+ "magicNumber" => self::uint32,
+ "flags" => self::uint16,
+ "unitsPerEm" => self::uint16,
+ "created" => self::longDateTime,
+ "modified" => self::longDateTime,
+ "xMin" => self::FWord,
+ "yMin" => self::FWord,
+ "xMax" => self::FWord,
+ "yMax" => self::FWord,
+ "macStyle" => self::uint16,
+ "lowestRecPPEM" => self::uint16,
+ "fontDirectionHint" => self::int16,
+ "indexToLocFormat" => self::int16,
+ "glyphDataFormat" => self::int16,
+ );
+
+ protected function _parse() {
+ parent::_parse();
+
+ if ($this->data["magicNumber"] != 0x5F0F3CF5) {
+ throw new Exception("Incorrect magic number (" . dechex($this->data["magicNumber"]) . ")");
+ }
+ }
+
+ function _encode() {
+ $this->data["checkSumAdjustment"] = 0;
+ return parent::_encode();
+ }
+}
\ No newline at end of file
diff --git a/app/libs/dompdf/vendor/dompdf/php-font-lib/src/FontLib/Table/Type/hhea.php b/app/libs/dompdf/vendor/dompdf/php-font-lib/src/FontLib/Table/Type/hhea.php
new file mode 100644
index 0000000..becb9a4
--- /dev/null
+++ b/app/libs/dompdf/vendor/dompdf/php-font-lib/src/FontLib/Table/Type/hhea.php
@@ -0,0 +1,43 @@
+ self::Fixed,
+ "ascent" => self::FWord,
+ "descent" => self::FWord,
+ "lineGap" => self::FWord,
+ "advanceWidthMax" => self::uFWord,
+ "minLeftSideBearing" => self::FWord,
+ "minRightSideBearing" => self::FWord,
+ "xMaxExtent" => self::FWord,
+ "caretSlopeRise" => self::int16,
+ "caretSlopeRun" => self::int16,
+ "caretOffset" => self::FWord,
+ self::int16,
+ self::int16,
+ self::int16,
+ self::int16,
+ "metricDataFormat" => self::int16,
+ "numOfLongHorMetrics" => self::uint16,
+ );
+
+ function _encode() {
+ $font = $this->getFont();
+ $this->data["numOfLongHorMetrics"] = count($font->getSubset());
+
+ return parent::_encode();
+ }
+}
\ No newline at end of file
diff --git a/app/libs/dompdf/vendor/dompdf/php-font-lib/src/FontLib/Table/Type/hmtx.php b/app/libs/dompdf/vendor/dompdf/php-font-lib/src/FontLib/Table/Type/hmtx.php
new file mode 100644
index 0000000..ccd37d7
--- /dev/null
+++ b/app/libs/dompdf/vendor/dompdf/php-font-lib/src/FontLib/Table/Type/hmtx.php
@@ -0,0 +1,64 @@
+getFont();
+ $offset = $font->pos();
+
+ $numOfLongHorMetrics = $font->getData("hhea", "numOfLongHorMetrics");
+ $numGlyphs = $font->getData("maxp", "numGlyphs");
+
+ $font->seek($offset);
+
+ $data = array();
+ $metrics = $font->readUInt16Many($numOfLongHorMetrics * 2);
+ for ($gid = 0, $mid = 0; $gid < $numOfLongHorMetrics; $gid++) {
+ $advanceWidth = isset($metrics[$mid]) ? $metrics[$mid] : 0;
+ $mid += 1;
+ $leftSideBearing = isset($metrics[$mid]) ? $metrics[$mid] : 0;
+ $mid += 1;
+ $data[$gid] = array($advanceWidth, $leftSideBearing);
+ }
+
+ if ($numOfLongHorMetrics < $numGlyphs) {
+ $lastWidth = end($data)[0];
+ $numLeft = $numGlyphs - $numOfLongHorMetrics;
+ $metrics = $font->readUInt16Many($numLeft);
+ for($i = 0; $i < $numLeft; $i++) {
+ $gid = $numOfLongHorMetrics + $i;
+ $leftSideBearing = isset($metrics[$i]) ? $metrics[$i] : 0;
+ $data[$gid] = array($lastWidth, $leftSideBearing);
+ }
+ }
+
+ $this->data = $data;
+ }
+
+ protected function _encode() {
+ $font = $this->getFont();
+ $subset = $font->getSubset();
+ $data = $this->data;
+
+ $length = 0;
+
+ foreach ($subset as $gid) {
+ $length += $font->writeUInt16($data[$gid][0]);
+ $length += $font->writeUInt16($data[$gid][1]);
+ }
+
+ return $length;
+ }
+}
\ No newline at end of file
diff --git a/app/libs/dompdf/vendor/dompdf/php-font-lib/src/FontLib/Table/Type/kern.php b/app/libs/dompdf/vendor/dompdf/php-font-lib/src/FontLib/Table/Type/kern.php
new file mode 100644
index 0000000..75f2c6f
--- /dev/null
+++ b/app/libs/dompdf/vendor/dompdf/php-font-lib/src/FontLib/Table/Type/kern.php
@@ -0,0 +1,79 @@
+getFont();
+
+ $data = $font->unpack(array(
+ "version" => self::uint16,
+ "nTables" => self::uint16,
+
+ // only the first subtable will be parsed
+ "subtableVersion" => self::uint16,
+ "length" => self::uint16,
+ "coverage" => self::uint16,
+ ));
+
+ $data["format"] = ($data["coverage"] >> 8);
+
+ $subtable = array();
+
+ switch ($data["format"]) {
+ case 0:
+ $subtable = $font->unpack(array(
+ "nPairs" => self::uint16,
+ "searchRange" => self::uint16,
+ "entrySelector" => self::uint16,
+ "rangeShift" => self::uint16,
+ ));
+
+ $pairs = array();
+ $tree = array();
+
+ $values = $font->readUInt16Many($subtable["nPairs"] * 3);
+ for ($i = 0, $idx = 0; $i < $subtable["nPairs"]; $i++) {
+ $left = $values[$idx++];
+ $right = $values[$idx++];
+ $value = $values[$idx++];
+
+ if ($value >= 0x8000) {
+ $value -= 0x10000;
+ }
+
+ $pairs[] = array(
+ "left" => $left,
+ "right" => $right,
+ "value" => $value,
+ );
+
+ $tree[$left][$right] = $value;
+ }
+
+ //$subtable["pairs"] = $pairs;
+ $subtable["tree"] = $tree;
+ break;
+
+ case 1:
+ case 2:
+ case 3:
+ break;
+ }
+
+ $data["subtable"] = $subtable;
+
+ $this->data = $data;
+ }
+}
\ No newline at end of file
diff --git a/app/libs/dompdf/vendor/dompdf/php-font-lib/src/FontLib/Table/Type/loca.php b/app/libs/dompdf/vendor/dompdf/php-font-lib/src/FontLib/Table/Type/loca.php
new file mode 100644
index 0000000..bbd87d1
--- /dev/null
+++ b/app/libs/dompdf/vendor/dompdf/php-font-lib/src/FontLib/Table/Type/loca.php
@@ -0,0 +1,79 @@
+getFont();
+ $offset = $font->pos();
+
+ $indexToLocFormat = $font->getData("head", "indexToLocFormat");
+ $numGlyphs = $font->getData("maxp", "numGlyphs");
+
+ $font->seek($offset);
+
+ $data = array();
+
+ // 2 bytes
+ if ($indexToLocFormat == 0) {
+ $d = $font->read(($numGlyphs + 1) * 2);
+ $loc = unpack("n*", $d);
+
+ for ($i = 0; $i <= $numGlyphs; $i++) {
+ $data[] = isset($loc[$i + 1]) ? $loc[$i + 1] * 2 : 0;
+ }
+ }
+
+ // 4 bytes
+ else {
+ if ($indexToLocFormat == 1) {
+ $d = $font->read(($numGlyphs + 1) * 4);
+ $loc = unpack("N*", $d);
+
+ for ($i = 0; $i <= $numGlyphs; $i++) {
+ $data[] = isset($loc[$i + 1]) ? $loc[$i + 1] : 0;
+ }
+ }
+ }
+
+ $this->data = $data;
+ }
+
+ function _encode() {
+ $font = $this->getFont();
+ $data = $this->data;
+
+ $indexToLocFormat = $font->getData("head", "indexToLocFormat");
+ $numGlyphs = $font->getData("maxp", "numGlyphs");
+ $length = 0;
+
+ // 2 bytes
+ if ($indexToLocFormat == 0) {
+ for ($i = 0; $i <= $numGlyphs; $i++) {
+ $length += $font->writeUInt16($data[$i] / 2);
+ }
+ }
+
+ // 4 bytes
+ else {
+ if ($indexToLocFormat == 1) {
+ for ($i = 0; $i <= $numGlyphs; $i++) {
+ $length += $font->writeUInt32($data[$i]);
+ }
+ }
+ }
+
+ return $length;
+ }
+}
\ No newline at end of file
diff --git a/app/libs/dompdf/vendor/dompdf/php-font-lib/src/FontLib/Table/Type/maxp.php b/app/libs/dompdf/vendor/dompdf/php-font-lib/src/FontLib/Table/Type/maxp.php
new file mode 100644
index 0000000..867125a
--- /dev/null
+++ b/app/libs/dompdf/vendor/dompdf/php-font-lib/src/FontLib/Table/Type/maxp.php
@@ -0,0 +1,41 @@
+ self::Fixed,
+ "numGlyphs" => self::uint16,
+ "maxPoints" => self::uint16,
+ "maxContours" => self::uint16,
+ "maxComponentPoints" => self::uint16,
+ "maxComponentContours" => self::uint16,
+ "maxZones" => self::uint16,
+ "maxTwilightPoints" => self::uint16,
+ "maxStorage" => self::uint16,
+ "maxFunctionDefs" => self::uint16,
+ "maxInstructionDefs" => self::uint16,
+ "maxStackElements" => self::uint16,
+ "maxSizeOfInstructions" => self::uint16,
+ "maxComponentElements" => self::uint16,
+ "maxComponentDepth" => self::uint16,
+ );
+
+ function _encode() {
+ $font = $this->getFont();
+ $this->data["numGlyphs"] = count($font->getSubset());
+
+ return parent::_encode();
+ }
+}
\ No newline at end of file
diff --git a/app/libs/dompdf/vendor/dompdf/php-font-lib/src/FontLib/Table/Type/name.php b/app/libs/dompdf/vendor/dompdf/php-font-lib/src/FontLib/Table/Type/name.php
new file mode 100644
index 0000000..003a1e8
--- /dev/null
+++ b/app/libs/dompdf/vendor/dompdf/php-font-lib/src/FontLib/Table/Type/name.php
@@ -0,0 +1,241 @@
+ self::uint16,
+ "count" => self::uint16,
+ "stringOffset" => self::uint16,
+ );
+
+ const NAME_COPYRIGHT = 0;
+ const NAME_NAME = 1;
+ const NAME_SUBFAMILY = 2;
+ const NAME_SUBFAMILY_ID = 3;
+ const NAME_FULL_NAME = 4;
+ const NAME_VERSION = 5;
+ const NAME_POSTSCRIPT_NAME = 6;
+ const NAME_TRADEMARK = 7;
+ const NAME_MANUFACTURER = 8;
+ const NAME_DESIGNER = 9;
+ const NAME_DESCRIPTION = 10;
+ const NAME_VENDOR_URL = 11;
+ const NAME_DESIGNER_URL = 12;
+ const NAME_LICENSE = 13;
+ const NAME_LICENSE_URL = 14;
+ const NAME_PREFERRE_FAMILY = 16;
+ const NAME_PREFERRE_SUBFAMILY = 17;
+ const NAME_COMPAT_FULL_NAME = 18;
+ const NAME_SAMPLE_TEXT = 19;
+
+ static $nameIdCodes = array(
+ 0 => "Copyright",
+ 1 => "FontName",
+ 2 => "FontSubfamily",
+ 3 => "UniqueID",
+ 4 => "FullName",
+ 5 => "Version",
+ 6 => "PostScriptName",
+ 7 => "Trademark",
+ 8 => "Manufacturer",
+ 9 => "Designer",
+ 10 => "Description",
+ 11 => "FontVendorURL",
+ 12 => "FontDesignerURL",
+ 13 => "LicenseDescription",
+ 14 => "LicenseURL",
+ // 15
+ 16 => "PreferredFamily",
+ 17 => "PreferredSubfamily",
+ 18 => "CompatibleFullName",
+ 19 => "SampleText",
+ );
+
+ static $platforms = array(
+ 0 => "Unicode",
+ 1 => "Macintosh",
+ // 2 => Reserved
+ 3 => "Microsoft",
+ );
+
+ static $platformSpecific = array(
+ // Unicode
+ 0 => array(
+ 0 => "Default semantics",
+ 1 => "Version 1.1 semantics",
+ 2 => "ISO 10646 1993 semantics (deprecated)",
+ 3 => "Unicode 2.0 or later semantics",
+ ),
+
+ // Macintosh
+ 1 => array(
+ 0 => "Roman",
+ 1 => "Japanese",
+ 2 => "Traditional Chinese",
+ 3 => "Korean",
+ 4 => "Arabic",
+ 5 => "Hebrew",
+ 6 => "Greek",
+ 7 => "Russian",
+ 8 => "RSymbol",
+ 9 => "Devanagari",
+ 10 => "Gurmukhi",
+ 11 => "Gujarati",
+ 12 => "Oriya",
+ 13 => "Bengali",
+ 14 => "Tamil",
+ 15 => "Telugu",
+ 16 => "Kannada",
+ 17 => "Malayalam",
+ 18 => "Sinhalese",
+ 19 => "Burmese",
+ 20 => "Khmer",
+ 21 => "Thai",
+ 22 => "Laotian",
+ 23 => "Georgian",
+ 24 => "Armenian",
+ 25 => "Simplified Chinese",
+ 26 => "Tibetan",
+ 27 => "Mongolian",
+ 28 => "Geez",
+ 29 => "Slavic",
+ 30 => "Vietnamese",
+ 31 => "Sindhi",
+ ),
+
+ // Microsoft
+ 3 => array(
+ 0 => "Symbol",
+ 1 => "Unicode BMP (UCS-2)",
+ 2 => "ShiftJIS",
+ 3 => "PRC",
+ 4 => "Big5",
+ 5 => "Wansung",
+ 6 => "Johab",
+ // 7 => Reserved
+ // 8 => Reserved
+ // 9 => Reserved
+ 10 => "Unicode UCS-4",
+ ),
+ );
+
+ protected function _parse() {
+ $font = $this->getFont();
+
+ $tableOffset = $font->pos();
+
+ $data = $font->unpack(self::$header_format);
+
+ $records = array();
+ for ($i = 0; $i < $data["count"]; $i++) {
+ $record = new nameRecord();
+ $record_data = $font->unpack(nameRecord::$format);
+ $record->map($record_data);
+
+ $records[] = $record;
+ }
+
+ $system_encodings = mb_list_encodings();
+ $system_encodings = array_change_key_case(array_fill_keys($system_encodings, true), CASE_UPPER);
+
+ $names = array();
+ foreach ($records as $record) {
+ $font->seek($tableOffset + $data["stringOffset"] + $record->offset);
+ $record->stringRaw = $font->read($record->length);
+
+ $encoding = null;
+ switch ($record->platformID) {
+ case 3:
+ switch ($record->platformSpecificID) {
+ case 2:
+ if (\array_key_exists("SJIS", $system_encodings)) {
+ $encoding = "SJIS";
+ }
+ break;
+ case 3:
+ if (\array_key_exists("GB18030", $system_encodings)) {
+ $encoding = "GB18030";
+ }
+ break;
+ case 4:
+ if (\array_key_exists("BIG-5", $system_encodings)) {
+ $encoding = "BIG-5";
+ }
+ break;
+ case 5:
+ if (\array_key_exists("UHC", $system_encodings)) {
+ $encoding = "UHC";
+ }
+ break;
+ }
+ break;
+ }
+ if ($encoding === null) {
+ $encoding = "UTF-16";
+ }
+
+ $record->string = mb_convert_encoding($record->stringRaw, "UTF-8", $encoding);
+ if (strpos($record->string, "\0") !== false) {
+ $record->string = str_replace("\0", "", $record->string);
+ }
+ $names[$record->nameID] = $record;
+ }
+
+ $data["records"] = $names;
+
+ $this->data = $data;
+ }
+
+ protected function _encode() {
+ $font = $this->getFont();
+
+ /** @var nameRecord[] $records */
+ $records = $this->data["records"];
+ $count_records = \count($records);
+
+ $this->data["count"] = $count_records;
+ $this->data["stringOffset"] = 6 + ($count_records * 12); // 6 => uint16 * 3, 12 => sizeof self::$record_format
+
+ $length = $font->pack(self::$header_format, $this->data);
+
+ $offset = 0;
+
+ /** @var nameRecord[] $records_to_encode */
+ $records_to_encode = array();
+ foreach ($records as $record) {
+ $encoded_record = new nameRecord();
+ $encoded_record->platformID = 3;
+ $encoded_record->platformSpecificID = 1;
+ $encoded_record->languageID = $record->languageID;
+ $encoded_record->nameID = $record->nameID;
+ $encoded_record->offset = $offset;
+ $encoded_record->string = $record->string;
+ $encoded_record->length = mb_strlen($encoded_record->getUTF16(), "8bit");
+ $records_to_encode[] = $encoded_record;
+
+ $offset += $encoded_record->length;
+ $length += $font->pack(nameRecord::$format, (array)$encoded_record);
+ }
+
+ foreach ($records_to_encode as $record) {
+ $str = $record->getUTF16();
+ $length += $font->write($str, mb_strlen($str, "8bit"));
+ }
+
+ return $length;
+ }
+}
diff --git a/app/libs/dompdf/vendor/dompdf/php-font-lib/src/FontLib/Table/Type/nameRecord.php b/app/libs/dompdf/vendor/dompdf/php-font-lib/src/FontLib/Table/Type/nameRecord.php
new file mode 100644
index 0000000..162629d
--- /dev/null
+++ b/app/libs/dompdf/vendor/dompdf/php-font-lib/src/FontLib/Table/Type/nameRecord.php
@@ -0,0 +1,53 @@
+ self::uint16,
+ "platformSpecificID" => self::uint16,
+ "languageID" => self::uint16,
+ "nameID" => self::uint16,
+ "length" => self::uint16,
+ "offset" => self::uint16,
+ );
+
+ public function map($data) {
+ foreach ($data as $key => $value) {
+ $this->$key = $value;
+ }
+ }
+
+ public function getUTF8() {
+ return $this->string;
+ }
+
+ public function getUTF16() {
+ return Font::UTF8ToUTF16($this->string);
+ }
+
+ function __toString() {
+ return $this->string;
+ }
+}
\ No newline at end of file
diff --git a/app/libs/dompdf/vendor/dompdf/php-font-lib/src/FontLib/Table/Type/os2.php b/app/libs/dompdf/vendor/dompdf/php-font-lib/src/FontLib/Table/Type/os2.php
new file mode 100644
index 0000000..b1a2016
--- /dev/null
+++ b/app/libs/dompdf/vendor/dompdf/php-font-lib/src/FontLib/Table/Type/os2.php
@@ -0,0 +1,46 @@
+ self::uint16,
+ "xAvgCharWidth" => self::int16,
+ "usWeightClass" => self::uint16,
+ "usWidthClass" => self::uint16,
+ "fsType" => self::int16,
+ "ySubscriptXSize" => self::int16,
+ "ySubscriptYSize" => self::int16,
+ "ySubscriptXOffset" => self::int16,
+ "ySubscriptYOffset" => self::int16,
+ "ySuperscriptXSize" => self::int16,
+ "ySuperscriptYSize" => self::int16,
+ "ySuperscriptXOffset" => self::int16,
+ "ySuperscriptYOffset" => self::int16,
+ "yStrikeoutSize" => self::int16,
+ "yStrikeoutPosition" => self::int16,
+ "sFamilyClass" => self::int16,
+ "panose" => array(self::uint8, 10),
+ "ulCharRange" => array(self::uint32, 4),
+ "achVendID" => array(self::char, 4),
+ "fsSelection" => self::uint16,
+ "fsFirstCharIndex" => self::uint16,
+ "fsLastCharIndex" => self::uint16,
+ "typoAscender" => self::int16,
+ "typoDescender" => self::int16,
+ "typoLineGap" => self::int16,
+ "winAscent" => self::int16,
+ "winDescent" => self::int16,
+ );
+}
\ No newline at end of file
diff --git a/app/libs/dompdf/vendor/dompdf/php-font-lib/src/FontLib/Table/Type/post.php b/app/libs/dompdf/vendor/dompdf/php-font-lib/src/FontLib/Table/Type/post.php
new file mode 100644
index 0000000..3b29c08
--- /dev/null
+++ b/app/libs/dompdf/vendor/dompdf/php-font-lib/src/FontLib/Table/Type/post.php
@@ -0,0 +1,142 @@
+ self::Fixed,
+ "italicAngle" => self::Fixed,
+ "underlinePosition" => self::FWord,
+ "underlineThickness" => self::FWord,
+ "isFixedPitch" => self::uint32,
+ "minMemType42" => self::uint32,
+ "maxMemType42" => self::uint32,
+ "minMemType1" => self::uint32,
+ "maxMemType1" => self::uint32,
+ );
+
+ protected function _parse() {
+ $font = $this->getFont();
+ $data = $font->unpack($this->def);
+
+ $names = array();
+
+ switch ($data["format"]) {
+ case 1:
+ $names = File::$macCharNames;
+ break;
+
+ case 2:
+ $data["numberOfGlyphs"] = $font->readUInt16();
+
+ $glyphNameIndex = $font->readUInt16Many($data["numberOfGlyphs"]);
+
+ $data["glyphNameIndex"] = $glyphNameIndex;
+
+ $namesPascal = array();
+ for ($i = 0; $i < $data["numberOfGlyphs"]; $i++) {
+ $len = $font->readUInt8();
+ $namesPascal[] = $font->read($len);
+ }
+
+ foreach ($glyphNameIndex as $g => $index) {
+ if ($index < 258) {
+ $names[$g] = File::$macCharNames[$index];
+ }
+ else {
+ if (array_key_exists($index - 258, $namesPascal)) {
+ $names[$g] = $namesPascal[$index - 258];
+ }
+ }
+ }
+
+ break;
+
+ case 2.5:
+ // TODO
+ break;
+
+ case 3:
+ // nothing
+ break;
+
+ case 4:
+ // TODO
+ break;
+ }
+
+ $data["names"] = $names;
+
+ $this->data = $data;
+ }
+
+ function _encode() {
+ $font = $this->getFont();
+ $data = $this->data;
+ $data["format"] = 3;
+
+ $length = $font->pack($this->def, $data);
+
+ return $length;
+ /*
+ $subset = $font->getSubset();
+
+ switch($data["format"]) {
+ case 1:
+ // nothing to do
+ break;
+
+ case 2:
+ $old_names = $data["names"];
+
+ $glyphNameIndex = range(0, count($subset));
+
+ $names = array();
+ foreach($subset as $gid) {
+ $names[] = $data["names"][$data["glyphNameIndex"][$gid]];
+ }
+
+ $numberOfGlyphs = count($names);
+ $length += $font->writeUInt16($numberOfGlyphs);
+
+ foreach($glyphNameIndex as $gni) {
+ $length += $font->writeUInt16($gni);
+ }
+
+ //$names = array_slice($names, 257);
+ foreach($names as $name) {
+ $len = strlen($name);
+ $length += $font->writeUInt8($len);
+ $length += $font->write($name, $len);
+ }
+
+ break;
+
+ case 2.5:
+ // TODO
+ break;
+
+ case 3:
+ // nothing
+ break;
+
+ case 4:
+ // TODO
+ break;
+ }
+
+ return $length;*/
+ }
+}
\ No newline at end of file
diff --git a/app/libs/dompdf/vendor/dompdf/php-font-lib/src/FontLib/Table/Type/prep.php b/app/libs/dompdf/vendor/dompdf/php-font-lib/src/FontLib/Table/Type/prep.php
new file mode 100644
index 0000000..a8442cf
--- /dev/null
+++ b/app/libs/dompdf/vendor/dompdf/php-font-lib/src/FontLib/Table/Type/prep.php
@@ -0,0 +1,29 @@
+getFont();
+ $font->seek($this->entry->offset);
+ $this->rawData = $font->read($this->entry->length);
+ }
+ function _encode() {
+ return $this->getFont()->write($this->rawData, $this->entry->length);
+ }
+}
diff --git a/app/libs/dompdf/vendor/dompdf/php-font-lib/src/FontLib/TrueType/Collection.php b/app/libs/dompdf/vendor/dompdf/php-font-lib/src/FontLib/TrueType/Collection.php
new file mode 100644
index 0000000..2c97030
--- /dev/null
+++ b/app/libs/dompdf/vendor/dompdf/php-font-lib/src/FontLib/TrueType/Collection.php
@@ -0,0 +1,99 @@
+numFonts)) {
+ return;
+ }
+
+ $this->read(4); // tag name
+
+ $this->version = $this->readFixed();
+ $this->numFonts = $this->readUInt32();
+
+ for ($i = 0; $i < $this->numFonts; $i++) {
+ $this->collectionOffsets[] = $this->readUInt32();
+ }
+ }
+
+ /**
+ * @param int $fontId
+ *
+ * @throws OutOfBoundsException
+ * @return File
+ */
+ function getFont($fontId) {
+ $this->parse();
+
+ if (!isset($this->collectionOffsets[$fontId])) {
+ throw new OutOfBoundsException();
+ }
+
+ if (isset($this->collection[$fontId])) {
+ return $this->collection[$fontId];
+ }
+
+ $font = new File();
+ $font->f = $this->f;
+ $font->setTableOffset($this->collectionOffsets[$fontId]);
+
+ return $this->collection[$fontId] = $font;
+ }
+
+ function current() {
+ return $this->getFont($this->position);
+ }
+
+ function key() {
+ return $this->position;
+ }
+
+ function next() {
+ return ++$this->position;
+ }
+
+ function rewind() {
+ $this->position = 0;
+ }
+
+ function valid() {
+ $this->parse();
+
+ return isset($this->collectionOffsets[$this->position]);
+ }
+
+ function count() {
+ $this->parse();
+
+ return $this->numFonts;
+ }
+}
diff --git a/app/libs/dompdf/vendor/dompdf/php-font-lib/src/FontLib/TrueType/File.php b/app/libs/dompdf/vendor/dompdf/php-font-lib/src/FontLib/TrueType/File.php
new file mode 100644
index 0000000..f4c797a
--- /dev/null
+++ b/app/libs/dompdf/vendor/dompdf/php-font-lib/src/FontLib/TrueType/File.php
@@ -0,0 +1,590 @@
+> 0x05) === 0x06) { // 2 bytes character (0x06 = 110 BIN)
+ $bytes[] = ($o - 0xC0) << 0x06;
+ $numbytes = 2;
+ } elseif (($o >> 0x04) === 0x0E) { // 3 bytes character (0x0E = 1110 BIN)
+ $bytes[] = ($o - 0xE0) << 0x0C;
+ $numbytes = 3;
+ } elseif (($o >> 0x03) === 0x1E) { // 4 bytes character (0x1E = 11110 BIN)
+ $bytes[] = ($o - 0xF0) << 0x12;
+ $numbytes = 4;
+ } else {
+ $ord = false;
+ break;
+ }
+ } elseif (($o >> 0x06) === 0x02) { // bytes 2, 3 and 4 must start with 0x02 = 10 BIN
+ $bytes[] = $o - 0x80;
+ if (\count($bytes) === $numbytes) {
+ // compose UTF-8 bytes to a single unicode value
+ $o = $bytes[0];
+ for ($j = 1; $j < $numbytes; $j++) {
+ $o += ($bytes[$j] << (($numbytes - $j - 1) * 0x06));
+ }
+ if ((($o >= 0xD800) and ($o <= 0xDFFF)) or ($o >= 0x10FFFF)) {
+ // The definition of UTF-8 prohibits encoding character numbers between
+ // U+D800 and U+DFFF, which are reserved for use with the UTF-16
+ // encoding form (as surrogate pairs) and do not directly represent
+ // characters.
+ return false;
+ } else {
+ $ord = $o; // add char to array
+ }
+ // reset data for next char
+ $bytes = [];
+ $numbytes = 1;
+ }
+ } else {
+ $ord = false;
+ break;
+ }
+ }
+
+ return $ord;
+ }
+
+ function getTable() {
+ $this->parseTableEntries();
+
+ return $this->directory;
+ }
+
+ function setTableOffset($offset) {
+ $this->tableOffset = $offset;
+ }
+
+ function parse() {
+ $this->parseTableEntries();
+
+ $this->data = array();
+
+ foreach ($this->directory as $tag => $table) {
+ if (empty($this->data[$tag])) {
+ $this->readTable($tag);
+ }
+ }
+ }
+
+ function utf8toUnicode($str) {
+ $len = mb_strlen($str, '8bit');
+ $out = array();
+
+ for ($i = 0; $i < $len; $i++) {
+ $uni = -1;
+ $h = ord($str[$i]);
+
+ if ($h <= 0x7F) {
+ $uni = $h;
+ }
+ elseif ($h >= 0xC2) {
+ if (($h <= 0xDF) && ($i < $len - 1)) {
+ $uni = ($h & 0x1F) << 6 | (ord($str[++$i]) & 0x3F);
+ }
+ elseif (($h <= 0xEF) && ($i < $len - 2)) {
+ $uni = ($h & 0x0F) << 12 | (ord($str[++$i]) & 0x3F) << 6 | (ord($str[++$i]) & 0x3F);
+ }
+ elseif (($h <= 0xF4) && ($i < $len - 3)) {
+ $uni = ($h & 0x0F) << 18 | (ord($str[++$i]) & 0x3F) << 12 | (ord($str[++$i]) & 0x3F) << 6 | (ord($str[++$i]) & 0x3F);
+ }
+ }
+
+ if ($uni >= 0) {
+ $out[] = $uni;
+ }
+ }
+
+ return $out;
+ }
+
+ function getUnicodeCharMap() {
+ $subtable = null;
+ foreach ($this->getData("cmap", "subtables") as $_subtable) {
+ if ($_subtable["platformID"] == 0 || ($_subtable["platformID"] == 3 && $_subtable["platformSpecificID"] == 1)) {
+ $subtable = $_subtable;
+ break;
+ }
+ }
+
+ if ($subtable) {
+ return $subtable["glyphIndexArray"];
+ }
+
+ $system_encodings = mb_list_encodings();
+ $system_encodings = array_change_key_case(array_fill_keys($system_encodings, true), CASE_UPPER);
+ foreach ($this->getData("cmap", "subtables") as $_subtable) {
+ $encoding = null;
+ switch ($_subtable["platformID"]) {
+ case 3:
+ switch ($_subtable["platformSpecificID"]) {
+ case 2:
+ if (\array_key_exists("SJIS", $system_encodings)) {
+ $encoding = "SJIS";
+ }
+ break;
+ case 3:
+ if (\array_key_exists("GB18030", $system_encodings)) {
+ $encoding = "GB18030";
+ }
+ break;
+ case 4:
+ if (\array_key_exists("BIG-5", $system_encodings)) {
+ $encoding = "BIG-5";
+ }
+ break;
+ case 5:
+ if (\array_key_exists("UHC", $system_encodings)) {
+ $encoding = "UHC";
+ }
+ break;
+ }
+ break;
+ }
+ if ($encoding) {
+ $glyphIndexArray = array();
+ foreach ($_subtable["glyphIndexArray"] as $c => $gid) {
+ $str = trim(pack("N", $c));
+ if (\strlen($str) > 0) {
+ $ord = $this->uniord($str, $encoding);
+ if ($ord > 0) {
+ $glyphIndexArray[$ord] = $gid;
+ }
+ }
+ }
+ return $glyphIndexArray;
+ }
+ }
+
+ return null;
+ }
+
+ function setSubset($subset) {
+ if (!is_array($subset)) {
+ $subset = $this->utf8toUnicode($subset);
+ }
+
+ $subset = array_unique($subset);
+
+ $glyphIndexArray = $this->getUnicodeCharMap();
+
+ if (!$glyphIndexArray) {
+ return;
+ }
+
+ $gids = array(
+ 0, // .notdef
+ 1, // .null
+ );
+
+ foreach ($subset as $code) {
+ if (!isset($glyphIndexArray[$code])) {
+ continue;
+ }
+
+ $gid = $glyphIndexArray[$code];
+ $gids[$gid] = $gid;
+ }
+
+ /** @var glyf $glyf */
+ $glyf = $this->getTableObject("glyf");
+ if ($glyf) {
+ $gids = $glyf->getGlyphIDs($gids);
+ sort($gids);
+ $this->glyph_subset = $gids;
+ }
+ $this->glyph_all = array_values($glyphIndexArray); // FIXME
+ }
+
+ function getSubset() {
+ if (empty($this->glyph_subset)) {
+ return $this->glyph_all;
+ }
+
+ return $this->glyph_subset;
+ }
+
+ function encode($tags = array()) {
+ if (!self::$raw) {
+ $tags = array_merge(array("head", "hhea", "cmap", "hmtx", "maxp", "glyf", "loca", "name", "post", "cvt ", "fpgm", "prep"), $tags);
+ }
+ else {
+ $tags = array_keys($this->directory);
+ }
+
+ $n = 16; // @todo
+
+ Font::d("Tables : " . implode(", ", $tags));
+
+ /** @var DirectoryEntry[] $entries */
+ $entries = array();
+ foreach ($tags as $tag) {
+ if (!isset($this->directory[$tag])) {
+ Font::d(" >> '$tag' table doesn't exist");
+ continue;
+ }
+
+ $entries[$tag] = $this->directory[$tag];
+ }
+
+ $num_tables = count($entries);
+ $exponent = floor(log($num_tables, 2));
+ $power_of_two = pow(2, $exponent);
+
+ $this->header->data["numTables"] = $num_tables;
+ $this->header->data["searchRange"] = $power_of_two * 16;
+ $this->header->data["entrySelector"] = log($power_of_two, 2);
+ $this->header->data["rangeShift"] = $num_tables * 16 - $this->header->data["searchRange"];
+ $this->header->encode();
+
+ $directory_offset = $this->pos();
+ $offset = $directory_offset + $num_tables * $n;
+ $this->seek($offset);
+
+ $i = 0;
+ foreach ($entries as $entry) {
+ $entry->encode($directory_offset + $i * $n);
+ $i++;
+ }
+ }
+
+ function parseHeader() {
+ if (!empty($this->header)) {
+ return;
+ }
+
+ $this->seek($this->tableOffset);
+
+ $this->header = new Header($this);
+ $this->header->parse();
+ }
+
+ function getFontType(){
+ $class_parts = explode("\\", get_class($this));
+ return $class_parts[1];
+ }
+
+ function parseTableEntries() {
+ $this->parseHeader();
+
+ if (!empty($this->directory)) {
+ return;
+ }
+
+ if (empty($this->header->data["numTables"])) {
+ return;
+ }
+
+
+ $type = $this->getFontType();
+ $class = "FontLib\\$type\\TableDirectoryEntry";
+
+ for ($i = 0; $i < $this->header->data["numTables"]; $i++) {
+ /** @var TableDirectoryEntry $entry */
+ $entry = new $class($this);
+ $entry->parse();
+
+ $this->directory[$entry->tag] = $entry;
+ }
+ }
+
+ function normalizeFUnit($value, $base = 1000) {
+ return round($value * ($base / $this->getData("head", "unitsPerEm")));
+ }
+
+ protected function readTable($tag) {
+ $this->parseTableEntries();
+
+ if (!self::$raw) {
+ $name_canon = preg_replace("/[^a-z0-9]/", "", strtolower($tag));
+
+ $class = "FontLib\\Table\\Type\\$name_canon";
+
+ if (!isset($this->directory[$tag]) || !@class_exists($class)) {
+ return;
+ }
+ }
+ else {
+ $class = "FontLib\\Table\\Table";
+ }
+
+ /** @var Table $table */
+ $table = new $class($this->directory[$tag]);
+ $table->parse();
+
+ $this->data[$tag] = $table;
+ }
+
+ /**
+ * @param $name
+ *
+ * @return Table
+ */
+ public function getTableObject($name) {
+ if (\array_key_exists($name, $this->data)) {
+ return $this->data[$name];
+ }
+ return null;
+ }
+
+ public function setTableObject($name, Table $data) {
+ $this->data[$name] = $data;
+ }
+
+ public function getData($name, $key = null) {
+ $this->parseTableEntries();
+
+ if (empty($this->data[$name])) {
+ $this->readTable($name);
+ }
+
+ if (!isset($this->data[$name])) {
+ return null;
+ }
+
+ if (!$key) {
+ return $this->data[$name]->data;
+ }
+ else {
+ return $this->data[$name]->data[$key];
+ }
+ }
+
+ function addDirectoryEntry(DirectoryEntry $entry) {
+ $this->directory[$entry->tag] = $entry;
+ }
+
+ function saveAdobeFontMetrics($file, $encoding = null) {
+ $afm = new AdobeFontMetrics($this);
+ $afm->write($file, $encoding);
+ }
+
+ /**
+ * Get a specific name table string value from its ID
+ *
+ * @param int $nameID The name ID
+ *
+ * @return string|null
+ */
+ function getNameTableString($nameID) {
+ /** @var nameRecord[] $records */
+ $records = $this->getData("name", "records");
+
+ if (!isset($records[$nameID])) {
+ return null;
+ }
+
+ return $records[$nameID]->string;
+ }
+
+ /**
+ * Get font copyright
+ *
+ * @return string|null
+ */
+ function getFontCopyright() {
+ return $this->getNameTableString(name::NAME_COPYRIGHT);
+ }
+
+ /**
+ * Get font name
+ *
+ * @return string|null
+ */
+ function getFontName() {
+ return $this->getNameTableString(name::NAME_NAME);
+ }
+
+ /**
+ * Get font subfamily
+ *
+ * @return string|null
+ */
+ function getFontSubfamily() {
+ return $this->getNameTableString(name::NAME_SUBFAMILY);
+ }
+
+ /**
+ * Get font subfamily ID
+ *
+ * @return string|null
+ */
+ function getFontSubfamilyID() {
+ return $this->getNameTableString(name::NAME_SUBFAMILY_ID);
+ }
+
+ /**
+ * Get font full name
+ *
+ * @return string|null
+ */
+ function getFontFullName() {
+ return $this->getNameTableString(name::NAME_FULL_NAME);
+ }
+
+ /**
+ * Get font version
+ *
+ * @return string|null
+ */
+ function getFontVersion() {
+ return $this->getNameTableString(name::NAME_VERSION);
+ }
+
+ /**
+ * Get font weight
+ *
+ * @return string|null
+ */
+ function getFontWeight() {
+ return $this->getTableObject("OS/2")->data["usWeightClass"];
+ }
+
+ /**
+ * Get font Postscript name
+ *
+ * @return string|null
+ */
+ function getFontPostscriptName() {
+ return $this->getNameTableString(name::NAME_POSTSCRIPT_NAME);
+ }
+
+ function reduce() {
+ $names_to_keep = array(
+ name::NAME_COPYRIGHT,
+ name::NAME_NAME,
+ name::NAME_SUBFAMILY,
+ name::NAME_SUBFAMILY_ID,
+ name::NAME_FULL_NAME,
+ name::NAME_VERSION,
+ name::NAME_POSTSCRIPT_NAME,
+ );
+
+ foreach ($this->data["name"]->data["records"] as $id => $rec) {
+ if (!in_array($id, $names_to_keep)) {
+ unset($this->data["name"]->data["records"][$id]);
+ }
+ }
+ }
+}
diff --git a/app/libs/dompdf/vendor/dompdf/php-font-lib/src/FontLib/TrueType/Header.php b/app/libs/dompdf/vendor/dompdf/php-font-lib/src/FontLib/TrueType/Header.php
new file mode 100644
index 0000000..7c04728
--- /dev/null
+++ b/app/libs/dompdf/vendor/dompdf/php-font-lib/src/FontLib/TrueType/Header.php
@@ -0,0 +1,30 @@
+ self::uint32,
+ "numTables" => self::uint16,
+ "searchRange" => self::uint16,
+ "entrySelector" => self::uint16,
+ "rangeShift" => self::uint16,
+ );
+
+ public function parse() {
+ parent::parse();
+
+ $format = $this->data["format"];
+ $this->data["formatText"] = $this->convertUInt32ToStr($format);
+ }
+}
\ No newline at end of file
diff --git a/app/libs/dompdf/vendor/dompdf/php-font-lib/src/FontLib/TrueType/TableDirectoryEntry.php b/app/libs/dompdf/vendor/dompdf/php-font-lib/src/FontLib/TrueType/TableDirectoryEntry.php
new file mode 100644
index 0000000..3ddd6d0
--- /dev/null
+++ b/app/libs/dompdf/vendor/dompdf/php-font-lib/src/FontLib/TrueType/TableDirectoryEntry.php
@@ -0,0 +1,32 @@
+font;
+ $this->checksum = $font->readUInt32();
+ $this->offset = $font->readUInt32();
+ $this->length = $font->readUInt32();
+ $this->entryLength += 12;
+ }
+}
+
diff --git a/app/libs/dompdf/vendor/dompdf/php-font-lib/src/FontLib/WOFF/File.php b/app/libs/dompdf/vendor/dompdf/php-font-lib/src/FontLib/WOFF/File.php
new file mode 100644
index 0000000..bbc40fb
--- /dev/null
+++ b/app/libs/dompdf/vendor/dompdf/php-font-lib/src/FontLib/WOFF/File.php
@@ -0,0 +1,80 @@
+header)) {
+ return;
+ }
+
+ $this->header = new Header($this);
+ $this->header->parse();
+ }
+
+ public function load($file) {
+ parent::load($file);
+
+ $this->parseTableEntries();
+ $dataOffset = $this->pos() + count($this->directory) * 20;
+
+ $fw = $this->getTempFile(false);
+ $fr = $this->f;
+
+ $this->f = $fw;
+ $offset = $this->header->encode();
+
+ foreach ($this->directory as $entry) {
+ // Read ...
+ $this->f = $fr;
+ $this->seek($entry->offset);
+ $data = $this->read($entry->length);
+
+ if ($entry->length < $entry->origLength) {
+ $data = (string) gzuncompress($data);
+ }
+
+ // Prepare data ...
+ $length = mb_strlen($data, '8bit');
+ $entry->length = $entry->origLength = $length;
+ $entry->offset = $dataOffset;
+
+ // Write ...
+ $this->f = $fw;
+
+ // Woff Entry
+ $this->seek($offset);
+ $offset += $this->write($entry->tag, 4); // tag
+ $offset += $this->writeUInt32($dataOffset); // offset
+ $offset += $this->writeUInt32($length); // length
+ $offset += $this->writeUInt32($length); // origLength
+ $offset += $this->writeUInt32(DirectoryEntry::computeChecksum($data)); // checksum
+
+ // Data
+ $this->seek($dataOffset);
+ $dataOffset += $this->write($data, $length);
+ }
+
+ $this->f = $fw;
+ $this->seek(0);
+
+ // Need to re-parse this, don't know why
+ $this->header = null;
+ $this->directory = array();
+ $this->parseTableEntries();
+ }
+}
diff --git a/app/libs/dompdf/vendor/dompdf/php-font-lib/src/FontLib/WOFF/Header.php b/app/libs/dompdf/vendor/dompdf/php-font-lib/src/FontLib/WOFF/Header.php
new file mode 100644
index 0000000..e87a8d3
--- /dev/null
+++ b/app/libs/dompdf/vendor/dompdf/php-font-lib/src/FontLib/WOFF/Header.php
@@ -0,0 +1,31 @@
+ self::uint32,
+ "flavor" => self::uint32,
+ "length" => self::uint32,
+ "numTables" => self::uint16,
+ self::uint16,
+ "totalSfntSize" => self::uint32,
+ "majorVersion" => self::uint16,
+ "minorVersion" => self::uint16,
+ "metaOffset" => self::uint32,
+ "metaLength" => self::uint32,
+ "metaOrigLength" => self::uint32,
+ "privOffset" => self::uint32,
+ "privLength" => self::uint32,
+ );
+}
\ No newline at end of file
diff --git a/app/libs/dompdf/vendor/dompdf/php-font-lib/src/FontLib/WOFF/TableDirectoryEntry.php b/app/libs/dompdf/vendor/dompdf/php-font-lib/src/FontLib/WOFF/TableDirectoryEntry.php
new file mode 100644
index 0000000..b57a650
--- /dev/null
+++ b/app/libs/dompdf/vendor/dompdf/php-font-lib/src/FontLib/WOFF/TableDirectoryEntry.php
@@ -0,0 +1,33 @@
+font;
+ $this->offset = $font->readUInt32();
+ $this->length = $font->readUInt32();
+ $this->origLength = $font->readUInt32();
+ $this->checksum = $font->readUInt32();
+ }
+}