PluginProbe
Yatra – Travel Booking & Tour Operator Software / 3.0.14.1
Yatra – Travel Booking & Tour Operator Software v3.0.14.1
3.0.16 3.0.15 3.0.14 3.0.14.1 3.0.14.2 3.0.12 3.0.13 3.0.11 3.0.10 3.0.9 3.0.8 3.0.7 3.0.6 3.0.5 3.0.5.1 3.0.4 3.0.3 3.0.2.9 3.0.2.7 3.0.2.8 3.0.2.6 trunk 1.0.0 2.0.0 2.0.1 All 84 releases
yatra / vendor / phenx / php-font-lib / src / FontLib / Font.php

Font.php in Yatra – Travel Booking & Tour Operator Software 3.0.14.1, at vendor/phenx/php-font-lib/src/FontLib/Font.php

90 lines 1.7 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 /**
3 * @package php-font-lib
4 * @link https://github.com/dompdf/php-font-lib
5 * @author Fabien Ménager <[email protected]>
6 * @license http://www.gnu.org/copyleft/lesser.html GNU Lesser General Public License
7 */
8
9 namespace FontLib;
10
11 use FontLib\Exception\FontNotFoundException;
12
13 /**
14 * Generic font file.
15 *
16 * @package php-font-lib
17 */
18 class Font {
19 static $debug = false;
20
21 /**
22 * @param string $file The font file
23 *
24 * @return TrueType\File|null $file
25 */
26 public static function load($file) {
27 if(!file_exists($file)){
28 throw new FontNotFoundException($file);
29 }
30
31 $header = file_get_contents($file, false, null, 0, 4);
32 $class = null;
33
34 switch ($header) {
35 case "\x00\x01\x00\x00":
36 case "true":
37 case "typ1":
38 $class = "TrueType\\File";
39 break;
40
41 case "OTTO":
42 $class = "OpenType\\File";
43 break;
44
45 case "wOFF":
46 $class = "WOFF\\File";
47 break;
48
49 case "ttcf":
50 $class = "TrueType\\Collection";
51 break;
52
53 // Unknown type or EOT
54 default:
55 $magicNumber = file_get_contents($file, false, null, 34, 2);
56
57 if ($magicNumber === "LP") {
58 $class = "EOT\\File";
59 }
60 }
61
62 if ($class) {
63 $class = "FontLib\\$class";
64
65 /** @var TrueType\File $obj */
66 $obj = new $class;
67 $obj->load($file);
68
69 return $obj;
70 }
71
72 return null;
73 }
74
75 static function d($str) {
76 if (!self::$debug) {
77 return;
78 }
79 echo "$str\n";
80 }
81
82 static function UTF16ToUTF8($str) {
83 return mb_convert_encoding($str, "utf-8", "utf-16");
84 }
85
86 static function UTF8ToUTF16($str) {
87 return mb_convert_encoding($str, "utf-16", "utf-8");
88 }
89 }
90