PluginProbe
WCPOS – Point of Sale (POS) plugin for WooCommerce / 1.10.18
WCPOS – Point of Sale (POS) plugin for WooCommerce v1.10.18
1.10.19 1.10.18 1.10.17 1.10.16 1.10.15 1.10.13 1.10.14 1.10.12 1.10.11 1.10.10 1.10.9 1.10.8 untagged-3d9b7ccddc54df87c672 1.10.7 1.10.6 1.10.5 1.10.3 1.10.4 1.10.2 1.10.1 1.10.0 1.9.17 1.9.15 1.9.16 1.9.14 All 163 releases
woocommerce-pos / vendor_prefixed / dompdf / php-font-lib / src / FontLib / Font.php

Font.php in WCPOS – Point of Sale (POS) plugin for WooCommerce 1.10.18, at vendor_prefixed/dompdf/php-font-lib/src/FontLib/Font.php

78 lines 2.0 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
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 use WCPOS\Vendor\FontLib\Exception\FontNotFoundException;
11 /**
12 * Generic font file.
13 *
14 * @package php-font-lib
15 */
16 class Font
17 {
18 static $debug = \false;
19 /**
20 * @param string $file The font file
21 *
22 * @return TrueType\File|null $file
23 */
24 public static function load($file)
25 {
26 if (!\file_exists($file)) {
27 throw new FontNotFoundException($file);
28 }
29 $header = \file_get_contents($file, \false, null, 0, 4);
30 $class = null;
31 switch ($header) {
32 case "\x00\x01\x00\x00":
33 case "true":
34 case "typ1":
35 $class = "TrueType\\File";
36 break;
37 case "OTTO":
38 $class = "OpenType\\File";
39 break;
40 case "wOFF":
41 $class = "WOFF\\File";
42 break;
43 case "ttcf":
44 $class = "TrueType\\Collection";
45 break;
46 // Unknown type or EOT
47 default:
48 $magicNumber = \file_get_contents($file, \false, null, 34, 2);
49 if ($magicNumber === "LP") {
50 $class = "EOT\\File";
51 }
52 }
53 if ($class) {
54 $class = "WCPOS\\Vendor\\FontLib\\{$class}";
55 /** @var TrueType\File $obj */
56 $obj = new $class();
57 $obj->load($file);
58 return $obj;
59 }
60 return null;
61 }
62 static function d($str)
63 {
64 if (!self::$debug) {
65 return;
66 }
67 echo "{$str}\n";
68 }
69 static function UTF16ToUTF8($str)
70 {
71 return \mb_convert_encoding($str, "utf-8", "utf-16");
72 }
73 static function UTF8ToUTF16($str)
74 {
75 return \mb_convert_encoding($str, "utf-16", "utf-8");
76 }
77 }
78