File tree Expand file tree Collapse file tree 3 files changed +14
-9
lines changed Expand file tree Collapse file tree 3 files changed +14
-9
lines changed Original file line number Diff line number Diff line change @@ -39,15 +39,20 @@ function parse() {
39
39
40
40
// TODO
41
41
}
42
-
43
- public function readUInt16 () {
44
- $ a = unpack ('vv ' , $ this ->read (2 ));
45
- return $ a ['v ' ];
46
- }
47
42
48
- public function readUInt32 () {
49
- $ a = unpack ('VV ' , $ this ->read (4 ));
50
- return $ a ['V ' ];
43
+ /**
44
+ * Little endian version of the read method
45
+ */
46
+ public function read ($ n ) {
47
+ if ($ n < 1 ) {
48
+ return "" ;
49
+ }
50
+
51
+ $ string = fread ($ this ->f , $ n );
52
+ $ chunks = str_split ($ string , 2 );
53
+ $ chunks = array_map ("strrev " , $ chunks );
54
+
55
+ return implode ("" , $ chunks );
51
56
}
52
57
53
58
/**
Original file line number Diff line number Diff line change @@ -68,7 +68,7 @@ private function readString($name) {
68
68
$ size = $ font ->readUInt16 ();
69
69
70
70
$ this ->data ["{$ name }Size " ] = $ size ;
71
- $ this ->data [$ name ] = $ font ->read ($ size );
71
+ $ this ->data [$ name ] = Font:: UTF16ToUTF8 ( $ font ->read ($ size) );
72
72
}
73
73
74
74
public function encode (){
You can’t perform that action at this time.
0 commit comments