| 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; |
| 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 |
{ |
| 17 |
private $f; |
| 18 |
function __construct($file) |
| 19 |
{ |
| 20 |
$this->f = \fopen($file, "r"); |
| 21 |
} |
| 22 |
function parse() |
| 23 |
{ |
| 24 |
$map = array(); |
| 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 |
\ksort($map); |
| 32 |
return $map; |
| 33 |
} |
| 34 |
} |
| 35 |
|