Debian Codegraph @

vendor/dompdf/php-font-lib/src/FontLib/EncodingMap.php

raw
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;
9
10 /**
11 * Encoding map used to map a code point to a Unicode char.
12 *
13 * @package php-font-lib
14 */
15 class EncodingMap {
16 private $f;
17
18 function __construct($file) {
19 $this->f = fopen($file, "r");
20 }
21
22 function parse() {
23 $map = array();
24
25 while ($line = fgets($this->f)) {
26 if (preg_match('/^[\!\=]([0-9A-F]{2,})\s+U\+([0-9A-F]{2})([0-9A-F]{2})\s+([^\s]+)/', $line, $matches)) {
27 $unicode = (hexdec($matches[2]) << 8) + hexdec($matches[3]);
28 $map[hexdec($matches[1])] = array($unicode, $matches[4]);
29 }
30 }
31
32 ksort($map);
33
34 return $map;
35 }
36 }