commiting uncommited changes on live site
[weblabels.fsf.org.git] / crm.fsf.org / 20131203 / files / sites / all / modules-old / civicrm / vendor / phenx / php-font-lib / src / FontLib / EncodingMap.php
1 <?php
2 /**
3 * @package php-font-lib
4 * @link https://github.com/PhenX/php-font-lib
5 * @author Fabien Ménager <fabien.menager@gmail.com>
6 * @license http://www.gnu.org/copyleft/lesser.html GNU Lesser General Public License
7 */
8
9 namespace FontLib;
10
11 /**
12 * Encoding map used to map a code point to a Unicode char.
13 *
14 * @package php-font-lib
15 */
16 class EncodingMap {
17 private $f;
18
19 function __construct($file) {
20 $this->f = fopen($file, "r");
21 }
22
23 function parse() {
24 $map = array();
25
26 while ($line = fgets($this->f)) {
27 if (preg_match('/^[\!\=]([0-9A-F]{2,})\s+U\+([0-9A-F]{2})([0-9A-F]{2})\s+([^\s]+)/', $line, $matches)) {
28 $unicode = (hexdec($matches[2]) << 8) + hexdec($matches[3]);
29 $map[hexdec($matches[1])] = array($unicode, $matches[4]);
30 }
31 }
32
33 ksort($map);
34
35 return $map;
36 }
37 }