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