@@ -333,63 +333,63 @@ char codes to StandardEncoding character codes. The encoding table is to be used
333
333
somewhere around "pdfEscape" call.
334
334
*/
335
335
336
- API . events [ 'addFonts' ] = function ( fontManagementObjects ) {
337
- // fontManagementObjects is {
338
- // 'fonts':font_ID-keyed hash of font objects
339
- // , 'dictionary': lookup object, linking ["FontFamily"]['Style'] to font ID
340
- //}
341
- var font
342
- , fontID
343
- , metrics
344
- , unicode_section
345
- , encoding = 'Unicode'
346
- , encodingBlock
347
-
348
- for ( fontID in fontManagementObjects . fonts ) {
349
- if ( fontManagementObjects . fonts . hasOwnProperty ( fontID ) ) {
350
- font = fontManagementObjects . fonts [ fontID ]
351
-
352
- // // we only ship 'Unicode' mappings and metrics. No need for loop.
353
- // // still, leaving this for the future.
354
-
355
- // for (encoding in fontMetrics){
356
- // if (fontMetrics.hasOwnProperty(encoding)) {
357
-
358
- metrics = fontMetrics [ encoding ] [ font . PostScriptName ]
359
- if ( metrics ) {
360
- if ( font . metadata [ encoding ] ) {
361
- unicode_section = font . metadata [ encoding ]
362
- } else {
363
- unicode_section = font . metadata [ encoding ] = { }
336
+ API . events . push ( [
337
+ 'addFonts'
338
+ , function ( fontManagementObjects ) {
339
+ // fontManagementObjects is {
340
+ // 'fonts':font_ID-keyed hash of font objects
341
+ // , 'dictionary': lookup object, linking ["FontFamily"]['Style'] to font ID
342
+ //}
343
+ var font
344
+ , fontID
345
+ , metrics
346
+ , unicode_section
347
+ , encoding = 'Unicode'
348
+ , encodingBlock
349
+
350
+ for ( fontID in fontManagementObjects . fonts ) {
351
+ if ( fontManagementObjects . fonts . hasOwnProperty ( fontID ) ) {
352
+ font = fontManagementObjects . fonts [ fontID ]
353
+
354
+ // // we only ship 'Unicode' mappings and metrics. No need for loop.
355
+ // // still, leaving this for the future.
356
+
357
+ // for (encoding in fontMetrics){
358
+ // if (fontMetrics.hasOwnProperty(encoding)) {
359
+
360
+ metrics = fontMetrics [ encoding ] [ font . PostScriptName ]
361
+ if ( metrics ) {
362
+ if ( font . metadata [ encoding ] ) {
363
+ unicode_section = font . metadata [ encoding ]
364
+ } else {
365
+ unicode_section = font . metadata [ encoding ] = { }
366
+ }
367
+
368
+ unicode_section . widths = metrics . widths
369
+ unicode_section . kerning = metrics . kerning
364
370
}
365
-
366
- unicode_section . widths = metrics . widths
367
- unicode_section . kerning = metrics . kerning
368
- }
369
- // }
370
- // }
371
- // for (encoding in encodings){
372
- // if (encodings.hasOwnProperty(encoding)) {
373
- encodingBlock = encodings [ encoding ] [ font . PostScriptName ]
374
- if ( encodingBlock ) {
375
- if ( font . metadata [ encoding ] ) {
376
- unicode_section = font . metadata [ encoding ]
377
- } else {
378
- unicode_section = font . metadata [ encoding ] = { }
379
- }
380
-
381
- unicode_section . encoding = encodingBlock
382
- if ( encodingBlock . codePages && encodingBlock . codePages . length ) {
383
- font . encoding = encodingBlock . codePages [ 0 ]
371
+ // }
372
+ // }
373
+ // for (encoding in encodings){
374
+ // if (encodings.hasOwnProperty(encoding)) {
375
+ encodingBlock = encodings [ encoding ] [ font . PostScriptName ]
376
+ if ( encodingBlock ) {
377
+ if ( font . metadata [ encoding ] ) {
378
+ unicode_section = font . metadata [ encoding ]
379
+ } else {
380
+ unicode_section = font . metadata [ encoding ] = { }
381
+ }
382
+
383
+ unicode_section . encoding = encodingBlock
384
+ if ( encodingBlock . codePages && encodingBlock . codePages . length ) {
385
+ font . encoding = encodingBlock . codePages [ 0 ]
386
+ }
384
387
}
385
- }
386
- // }
387
- // }
388
+ // }
389
+ // }
390
+ }
388
391
}
389
392
}
390
-
391
-
392
-
393
- }
393
+ ] ) // end of adding event handler
394
394
395
395
} ) ( jsPDF . API ) ;
0 commit comments