File tree Expand file tree Collapse file tree 2 files changed +35
-4
lines changed Expand file tree Collapse file tree 2 files changed +35
-4
lines changed Original file line number Diff line number Diff line change @@ -311,13 +311,19 @@ var PDFPageProxy = (function PDFPageProxyClosure() {
311
311
ensureFonts : function PDFPageProxy_ensureFonts (fonts , callback ) {
312
312
this .stats .time ('Font Loading' );
313
313
// Convert the font names to the corresponding font obj.
314
+ var fontObjs = [];
314
315
for (var i = 0 , ii = fonts .length ; i < ii ; i ++) {
315
- fonts [i ] = this .objs .objs [fonts [i ]].data ;
316
+ var obj = this .objs .objs [fonts [i ]].data ;
317
+ if (obj .error ) {
318
+ warn ('Error during font loading: ' + obj .error );
319
+ continue ;
320
+ }
321
+ fontObjs .push (obj );
316
322
}
317
323
318
324
// Load all the fonts
319
325
FontLoader .bind (
320
- fonts ,
326
+ fontObjs ,
321
327
function pageEnsureFontsFontObjs (fontObjs ) {
322
328
this .stats .timeEnd ('Font Loading' );
323
329
@@ -565,7 +571,12 @@ var WorkerTransport = (function WorkerTransportClosure() {
565
571
566
572
// At this point, only the font object is created but the font is
567
573
// not yet attached to the DOM. This is done in `FontLoader.bind`.
568
- var font = new Font (name , file , properties );
574
+ var font ;
575
+ try {
576
+ font = new Font (name , file , properties );
577
+ } catch (e ) {
578
+ font = new ErrorFont (e );
579
+ }
569
580
this .objs .resolve (id , font );
570
581
break ;
571
582
default :
Original file line number Diff line number Diff line change @@ -1577,13 +1577,19 @@ var Font = (function FontClosure() {
1577
1577
return ;
1578
1578
}
1579
1579
1580
+ // Some fonts might use wrong font types for Type1C or CIDFontType0C
1581
+ var subtype = properties .subtype ;
1582
+ if (subtype == 'Type1C' && (type != 'Type1' && type != 'MMType1' ))
1583
+ type = 'Type1' ;
1584
+ if (subtype == 'CIDFontType0C' && type != 'CIDFontType0' )
1585
+ type = 'CIDFontType0' ;
1586
+
1580
1587
var data ;
1581
1588
switch (type ) {
1582
1589
case 'Type1' :
1583
1590
case 'CIDFontType0' :
1584
1591
this .mimetype = 'font/opentype' ;
1585
1592
1586
- var subtype = properties .subtype ;
1587
1593
var cff = (subtype == 'Type1C' || subtype == 'CIDFontType0C' ) ?
1588
1594
new CFFFont (file , properties ) : new Type1Font (name , file , properties );
1589
1595
@@ -3309,6 +3315,20 @@ var Font = (function FontClosure() {
3309
3315
return Font ;
3310
3316
})();
3311
3317
3318
+ var ErrorFont = (function ErrorFontClosure () {
3319
+ function ErrorFont (error ) {
3320
+ this .error = error ;
3321
+ }
3322
+
3323
+ ErrorFont .prototype = {
3324
+ charsToGlyphs : function ErrorFont_charsToGlyphs () {
3325
+ return [];
3326
+ }
3327
+ };
3328
+
3329
+ return ErrorFont ;
3330
+ })();
3331
+
3312
3332
var CallothersubrCmd = (function CallothersubrCmdClosure () {
3313
3333
function CallothersubrCmd (index ) {
3314
3334
this .index = index ;
You can’t perform that action at this time.
0 commit comments