File tree Expand file tree Collapse file tree 2 files changed +10
-5
lines changed Expand file tree Collapse file tree 2 files changed +10
-5
lines changed Original file line number Diff line number Diff line change @@ -310,8 +310,13 @@ function parseBuffer(buffer, opt={}) {
310
310
metaTableEntry = tableEntry ;
311
311
break ;
312
312
case 'gasp' :
313
- table = uncompressTable ( data , tableEntry ) ;
314
- font . tables . gasp = gasp . parse ( table . data , table . offset ) ;
313
+ try {
314
+ table = uncompressTable ( data , tableEntry ) ;
315
+ font . tables . gasp = gasp . parse ( table . data , table . offset ) ;
316
+ } catch ( e ) {
317
+ console . warn ( 'Failed to parse gasp table, skipping.' ) ;
318
+ console . warn ( e ) ;
319
+ }
315
320
break ;
316
321
case 'SVG ' :
317
322
table = uncompressTable ( data , tableEntry ) ;
Original file line number Diff line number Diff line change @@ -34,9 +34,9 @@ function makeGaspTable(gasp) {
34
34
{ name : 'numRanges' , type : 'USHORT' , value : gasp . numRanges } ,
35
35
] ) ;
36
36
37
- for ( let i in gasp . numRanges ) {
38
- result . fields . push ( { name : 'rangeMaxPPEM' , type : 'USHORT' , value : gasp . numRanges [ i ] . rangeMaxPPEM } ) ;
39
- result . fields . push ( { name : 'rangeGaspBehavior' , type : 'USHORT' , value : gasp . numRanges [ i ] . rangeGaspBehavior } ) ;
37
+ for ( let i in gasp . gaspRanges ) {
38
+ result . fields . push ( { name : 'rangeMaxPPEM' , type : 'USHORT' , value : gasp . gaspRanges [ i ] . rangeMaxPPEM } ) ;
39
+ result . fields . push ( { name : 'rangeGaspBehavior' , type : 'USHORT' , value : gasp . gaspRanges [ i ] . rangeGaspBehavior } ) ;
40
40
}
41
41
42
42
return result ;
You can’t perform that action at this time.
0 commit comments