File tree Expand file tree Collapse file tree 4 files changed +18
-15
lines changed Expand file tree Collapse file tree 4 files changed +18
-15
lines changed Original file line number Diff line number Diff line change @@ -64,15 +64,15 @@ protected function _parse() {
6464 $ segCount = $ subtable ["segCountX2 " ] / 2 ;
6565 $ subtable ["segCount " ] = $ segCount ;
6666
67- $ endCode = $ font ->r ( array ( self ::uint16, $ segCount) );
67+ $ endCode = $ font ->readUInt16Many ( $ segCount );
6868
6969 $ font ->readUInt16 (); // reservedPad
7070
71- $ startCode = $ font ->r ( array ( self ::uint16, $ segCount) );
72- $ idDelta = $ font ->r ( array ( self ::int16, $ segCount) );
71+ $ startCode = $ font ->readUInt16Many ( $ segCount );
72+ $ idDelta = $ font ->readInt16Many ( $ segCount );
7373
7474 $ ro_start = $ font ->pos ();
75- $ idRangeOffset = $ font ->r ( array ( self ::uint16, $ segCount) );
75+ $ idRangeOffset = $ font ->readUInt16Many ( $ segCount );
7676
7777 $ glyphIndexArray = array ();
7878 for ($ i = 0 ; $ i < $ segCount ; $ i ++) {
Original file line number Diff line number Diff line change @@ -25,9 +25,10 @@ protected function _parse() {
2525 $ font ->seek ($ offset );
2626
2727 $ data = array ();
28- for ($ gid = 0 ; $ gid < $ numOfLongHorMetrics ; $ gid ++) {
29- $ advanceWidth = $ font ->readUInt16 ();
30- $ leftSideBearing = $ font ->readUInt16 ();
28+ $ metrics = $ font ->readUInt16Many ($ numOfLongHorMetrics * 2 );
29+ for ($ gid = 0 , $ mid = 0 ; $ gid < $ numOfLongHorMetrics ; $ gid ++) {
30+ $ advanceWidth = $ metrics [$ mid ++];
31+ $ leftSideBearing = $ metrics [$ mid ++];
3132 $ data [$ gid ] = array ($ advanceWidth , $ leftSideBearing );
3233 }
3334
Original file line number Diff line number Diff line change @@ -44,10 +44,15 @@ protected function _parse() {
4444 $ pairs = array ();
4545 $ tree = array ();
4646
47- for ($ i = 0 ; $ i < $ subtable ["nPairs " ]; $ i ++) {
48- $ left = $ font ->readUInt16 ();
49- $ right = $ font ->readUInt16 ();
50- $ value = $ font ->readInt16 ();
47+ $ values = $ font ->readUInt16Many ($ subtable ["nPairs " ] * 3 );
48+ for ($ i = 0 , $ idx = 0 ; $ i < $ subtable ["nPairs " ]; $ i ++) {
49+ $ left = $ values [$ idx ++];
50+ $ right = $ values [$ idx ++];
51+ $ value = $ values [$ idx ++];
52+
53+ if ($ value >= 0x8000 ) {
54+ $ value -= 0x10000 ;
55+ }
5156
5257 $ pairs [] = array (
5358 "left " => $ left ,
Original file line number Diff line number Diff line change @@ -42,10 +42,7 @@ protected function _parse() {
4242 case 2 :
4343 $ data ["numberOfGlyphs " ] = $ font ->readUInt16 ();
4444
45- $ glyphNameIndex = array ();
46- for ($ i = 0 ; $ i < $ data ["numberOfGlyphs " ]; $ i ++) {
47- $ glyphNameIndex [] = $ font ->readUInt16 ();
48- }
45+ $ glyphNameIndex = $ font ->readUInt16Many ($ data ["numberOfGlyphs " ]);
4946
5047 $ data ["glyphNameIndex " ] = $ glyphNameIndex ;
5148
You can’t perform that action at this time.
0 commit comments