pdfjs-dist 2.2.228 → 2.6.347

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.

Potentially problematic release.


This version of pdfjs-dist might be problematic. Click here for more details.

Files changed (229) hide show
  1. package/README.md +4 -0
  2. package/bower.json +1 -1
  3. package/build/pdf.js +8816 -19300
  4. package/build/pdf.js.map +1 -1
  5. package/build/pdf.min.js +22 -1
  6. package/build/pdf.worker.entry.js +5 -3
  7. package/build/pdf.worker.js +27185 -35746
  8. package/build/pdf.worker.js.map +1 -1
  9. package/build/pdf.worker.min.js +22 -1
  10. package/es5/build/pdf.js +26665 -0
  11. package/es5/build/pdf.js.map +1 -0
  12. package/es5/build/pdf.min.js +22 -0
  13. package/{lib/shared/global_scope.js → es5/build/pdf.worker.entry.js} +5 -10
  14. package/es5/build/pdf.worker.js +61231 -0
  15. package/es5/build/pdf.worker.js.map +1 -0
  16. package/es5/build/pdf.worker.min.js +22 -0
  17. package/es5/image_decoders/pdf.image_decoders.js +12529 -0
  18. package/es5/image_decoders/pdf.image_decoders.js.map +1 -0
  19. package/es5/image_decoders/pdf.image_decoders.min.js +22 -0
  20. package/es5/web/images/annotation-check.svg +11 -0
  21. package/es5/web/images/annotation-comment.svg +16 -0
  22. package/es5/web/images/annotation-help.svg +26 -0
  23. package/es5/web/images/annotation-insert.svg +10 -0
  24. package/es5/web/images/annotation-key.svg +11 -0
  25. package/es5/web/images/annotation-newparagraph.svg +11 -0
  26. package/es5/web/images/annotation-noicon.svg +7 -0
  27. package/es5/web/images/annotation-note.svg +42 -0
  28. package/es5/web/images/annotation-paragraph.svg +16 -0
  29. package/es5/web/images/loading-icon.gif +0 -0
  30. package/es5/web/images/shadow.png +0 -0
  31. package/es5/web/pdf_viewer.css +406 -0
  32. package/es5/web/pdf_viewer.js +7886 -0
  33. package/es5/web/pdf_viewer.js.map +1 -0
  34. package/image_decoders/pdf.image_decoders.js +1498 -4832
  35. package/image_decoders/pdf.image_decoders.js.map +1 -1
  36. package/image_decoders/pdf.image_decoders.min.js +22 -1
  37. package/lib/README.md +7 -0
  38. package/lib/core/annotation.js +1144 -927
  39. package/lib/core/arithmetic_decoder.js +81 -97
  40. package/lib/core/bidi.js +54 -46
  41. package/lib/core/ccitt.js +88 -81
  42. package/lib/core/ccitt_stream.js +15 -14
  43. package/lib/core/cff_parser.js +747 -716
  44. package/lib/core/charsets.js +4 -4
  45. package/lib/core/chunked_stream.js +462 -553
  46. package/lib/core/cmap.js +231 -277
  47. package/lib/core/colorspace.js +715 -857
  48. package/lib/core/core_utils.js +57 -52
  49. package/lib/core/crypto.js +416 -437
  50. package/lib/core/document.js +629 -670
  51. package/lib/core/encodings.js +15 -15
  52. package/lib/core/evaluator.js +3229 -2800
  53. package/lib/core/font_renderer.js +135 -178
  54. package/lib/core/fonts.js +602 -534
  55. package/lib/core/function.js +355 -279
  56. package/lib/core/glyphlist.js +4527 -4526
  57. package/lib/core/image.js +442 -439
  58. package/lib/core/image_utils.js +221 -61
  59. package/lib/core/jbig2.js +325 -316
  60. package/lib/core/jbig2_stream.js +18 -17
  61. package/lib/core/jpeg_stream.js +21 -26
  62. package/lib/core/jpg.js +289 -233
  63. package/lib/core/jpx.js +161 -143
  64. package/lib/core/jpx_stream.js +28 -28
  65. package/lib/core/metrics.js +2928 -2928
  66. package/lib/core/murmurhash3.js +87 -102
  67. package/lib/core/obj.js +1343 -1300
  68. package/lib/core/operator_list.js +90 -67
  69. package/lib/core/parser.js +990 -987
  70. package/lib/core/pattern.js +105 -77
  71. package/lib/core/pdf_manager.js +149 -316
  72. package/lib/core/primitives.js +156 -104
  73. package/lib/core/ps_parser.js +175 -214
  74. package/lib/core/standard_fonts.js +237 -236
  75. package/lib/core/stream.js +94 -74
  76. package/lib/core/type1_parser.js +89 -69
  77. package/lib/core/unicode.js +1654 -1654
  78. package/lib/core/worker.js +275 -290
  79. package/lib/core/worker_stream.js +101 -210
  80. package/lib/core/writer.js +242 -0
  81. package/lib/display/annotation_layer.js +772 -1041
  82. package/lib/display/annotation_storage.js +89 -0
  83. package/lib/display/api.js +1575 -1868
  84. package/lib/display/api_compatibility.js +12 -17
  85. package/lib/display/canvas.js +370 -222
  86. package/lib/display/content_disposition.js +40 -59
  87. package/lib/display/display_utils.js +341 -536
  88. package/lib/display/fetch_stream.js +188 -304
  89. package/lib/display/font_loader.js +282 -414
  90. package/lib/display/metadata.js +81 -99
  91. package/lib/display/network.js +362 -511
  92. package/lib/display/network_utils.js +25 -18
  93. package/lib/display/node_stream.js +283 -465
  94. package/lib/display/node_utils.js +87 -0
  95. package/lib/display/optional_content_config.js +184 -0
  96. package/lib/display/pattern_helper.js +93 -44
  97. package/lib/display/svg.js +1163 -1401
  98. package/lib/display/text_layer.js +154 -137
  99. package/lib/display/transport_stream.js +237 -375
  100. package/lib/display/webgl.js +70 -83
  101. package/lib/display/worker_options.js +3 -3
  102. package/lib/display/xml_parser.js +303 -392
  103. package/lib/examples/node/domstubs.js +37 -37
  104. package/lib/pdf.js +220 -58
  105. package/lib/pdf.worker.js +14 -6
  106. package/lib/shared/compatibility.js +3 -246
  107. package/lib/shared/is_node.js +7 -6
  108. package/lib/shared/message_handler.js +327 -332
  109. package/lib/shared/util.js +271 -306
  110. package/lib/test/unit/annotation_spec.js +1902 -763
  111. package/lib/test/unit/annotation_storage_spec.js +83 -0
  112. package/lib/test/unit/api_spec.js +790 -592
  113. package/lib/test/unit/bidi_spec.js +7 -7
  114. package/lib/test/unit/cff_parser_spec.js +73 -72
  115. package/lib/test/unit/clitests_helper.js +7 -9
  116. package/lib/test/unit/cmap_spec.js +86 -88
  117. package/lib/test/unit/colorspace_spec.js +346 -154
  118. package/lib/test/unit/core_utils_spec.js +125 -105
  119. package/lib/test/unit/crypto_spec.js +232 -185
  120. package/lib/test/unit/custom_spec.js +150 -24
  121. package/lib/test/unit/display_svg_spec.js +34 -39
  122. package/lib/test/unit/display_utils_spec.js +139 -149
  123. package/lib/test/unit/document_spec.js +128 -17
  124. package/lib/test/unit/encodings_spec.js +12 -34
  125. package/lib/test/unit/evaluator_spec.js +112 -91
  126. package/lib/test/unit/fetch_stream_spec.js +31 -29
  127. package/lib/test/unit/function_spec.js +206 -204
  128. package/lib/test/unit/jasmine-boot.js +48 -32
  129. package/lib/test/unit/message_handler_spec.js +173 -159
  130. package/lib/test/unit/metadata_spec.js +71 -71
  131. package/lib/test/unit/murmurhash3_spec.js +12 -12
  132. package/lib/test/unit/network_spec.js +13 -11
  133. package/lib/test/unit/network_utils_spec.js +158 -144
  134. package/lib/test/unit/node_stream_spec.js +76 -90
  135. package/lib/test/unit/parser_spec.js +108 -114
  136. package/lib/test/unit/pdf_find_controller_spec.js +55 -86
  137. package/lib/test/unit/pdf_find_utils_spec.js +32 -32
  138. package/lib/test/unit/pdf_history_spec.js +32 -32
  139. package/lib/test/unit/primitives_spec.js +337 -156
  140. package/lib/test/unit/stream_spec.js +16 -14
  141. package/lib/test/unit/test_utils.js +91 -304
  142. package/lib/test/unit/testreporter.js +33 -22
  143. package/lib/test/unit/type1_parser_spec.js +42 -42
  144. package/lib/test/unit/ui_utils_spec.js +299 -461
  145. package/lib/test/unit/unicode_spec.js +42 -42
  146. package/lib/test/unit/util_spec.js +129 -149
  147. package/lib/test/unit/writer_spec.js +84 -0
  148. package/lib/web/annotation_layer_builder.js +78 -111
  149. package/lib/web/app.js +1542 -1267
  150. package/lib/web/app_options.js +76 -91
  151. package/lib/web/base_tree_viewer.js +100 -0
  152. package/lib/web/base_viewer.js +869 -834
  153. package/lib/web/chromecom.js +165 -252
  154. package/lib/web/debugger.js +149 -205
  155. package/lib/web/download_manager.js +34 -58
  156. package/lib/web/firefox_print_service.js +62 -34
  157. package/lib/web/firefoxcom.js +206 -374
  158. package/lib/web/genericcom.js +26 -108
  159. package/lib/web/genericl10n.js +24 -153
  160. package/lib/web/grab_to_pan.js +30 -30
  161. package/lib/web/interfaces.js +80 -254
  162. package/lib/web/overlay_manager.js +70 -246
  163. package/lib/web/password_prompt.js +38 -64
  164. package/lib/web/pdf_attachment_viewer.js +150 -126
  165. package/lib/web/pdf_cursor_tools.js +75 -102
  166. package/lib/web/pdf_document_properties.js +229 -383
  167. package/lib/web/pdf_find_bar.js +136 -170
  168. package/lib/web/pdf_find_controller.js +492 -548
  169. package/lib/web/pdf_find_utils.js +13 -13
  170. package/lib/web/pdf_history.js +397 -406
  171. package/lib/web/pdf_layer_viewer.js +208 -0
  172. package/lib/web/pdf_link_service.js +304 -348
  173. package/lib/web/pdf_outline_viewer.js +119 -212
  174. package/lib/web/pdf_page_view.js +474 -513
  175. package/lib/web/pdf_presentation_mode.js +308 -357
  176. package/lib/web/pdf_print_service.js +96 -110
  177. package/lib/web/pdf_rendering_queue.js +87 -108
  178. package/lib/web/pdf_sidebar.js +286 -302
  179. package/lib/web/pdf_sidebar_resizer.js +92 -119
  180. package/lib/web/pdf_single_page_viewer.js +77 -126
  181. package/lib/web/pdf_thumbnail_view.js +289 -297
  182. package/lib/web/pdf_thumbnail_viewer.js +202 -206
  183. package/lib/web/pdf_viewer.component.js +20 -21
  184. package/lib/web/pdf_viewer.js +55 -115
  185. package/lib/web/preferences.js +69 -273
  186. package/lib/web/secondary_toolbar.js +164 -196
  187. package/lib/web/text_layer_builder.js +284 -319
  188. package/lib/web/toolbar.js +217 -210
  189. package/lib/web/ui_utils.js +274 -421
  190. package/lib/web/view_history.js +52 -226
  191. package/lib/web/viewer_compatibility.js +21 -6
  192. package/package.json +4 -9
  193. package/types/display/annotation_layer.d.ts +61 -0
  194. package/types/display/annotation_storage.d.ts +36 -0
  195. package/types/display/api.d.ts +1107 -0
  196. package/types/display/api_compatibility.d.ts +1 -0
  197. package/types/display/canvas.d.ts +4 -0
  198. package/types/display/content_disposition.d.ts +7 -0
  199. package/types/display/display_utils.d.ts +243 -0
  200. package/types/display/fetch_stream.d.ts +67 -0
  201. package/types/display/font_loader.d.ts +19 -0
  202. package/types/display/metadata.d.ts +9 -0
  203. package/types/display/network.d.ts +80 -0
  204. package/types/display/network_utils.d.ts +14 -0
  205. package/types/display/node_stream.d.ts +72 -0
  206. package/types/display/node_utils.d.ts +6 -0
  207. package/types/display/optional_content_config.d.ts +12 -0
  208. package/types/display/pattern_helper.d.ts +5 -0
  209. package/types/display/svg.d.ts +2 -0
  210. package/types/display/text_layer.d.ts +83 -0
  211. package/types/display/transport_stream.d.ts +57 -0
  212. package/types/display/webgl.d.ts +20 -0
  213. package/types/display/worker_options.d.ts +27 -0
  214. package/types/display/xml_parser.d.ts +35 -0
  215. package/types/pdf.d.ts +33 -0
  216. package/types/shared/compatibility.d.ts +1 -0
  217. package/types/shared/is_node.d.ts +1 -0
  218. package/types/shared/message_handler.d.ts +62 -0
  219. package/types/shared/util.d.ts +421 -0
  220. package/web/images/shadow.png +0 -0
  221. package/web/pdf_viewer.css +29 -27
  222. package/web/pdf_viewer.js +3524 -4746
  223. package/web/pdf_viewer.js.map +1 -1
  224. package/webpack.js +6 -5
  225. package/external/streams/streams-lib.js +0 -3962
  226. package/external/url/url-lib.js +0 -627
  227. package/lib/shared/streams_polyfill.js +0 -43
  228. package/lib/shared/url_polyfill.js +0 -56
  229. package/web/images/texture.png +0 -0
@@ -2,7 +2,7 @@
2
2
  * @licstart The following is the entire license notice for the
3
3
  * Javascript code in this page
4
4
  *
5
- * Copyright 2019 Mozilla Foundation
5
+ * Copyright 2020 Mozilla Foundation
6
6
  *
7
7
  * Licensed under the Apache License, Version 2.0 (the "License");
8
8
  * you may not use this file except in compliance with the License.
@@ -26,31 +26,33 @@ Object.defineProperty(exports, "__esModule", {
26
26
  });
27
27
  exports.Type1Parser = void 0;
28
28
 
29
- var _util = require("../shared/util");
29
+ var _encodings = require("./encodings.js");
30
30
 
31
- var _encodings = require("./encodings");
31
+ var _core_utils = require("./core_utils.js");
32
32
 
33
- var _stream = require("./stream");
33
+ var _stream = require("./stream.js");
34
+
35
+ var _util = require("../shared/util.js");
34
36
 
35
37
  var HINTING_ENABLED = false;
36
38
 
37
39
  var Type1CharString = function Type1CharStringClosure() {
38
40
  var COMMAND_MAP = {
39
- 'hstem': [1],
40
- 'vstem': [3],
41
- 'vmoveto': [4],
42
- 'rlineto': [5],
43
- 'hlineto': [6],
44
- 'vlineto': [7],
45
- 'rrcurveto': [8],
46
- 'callsubr': [10],
47
- 'flex': [12, 35],
48
- 'drop': [12, 18],
49
- 'endchar': [14],
50
- 'rmoveto': [21],
51
- 'hmoveto': [22],
52
- 'vhcurveto': [30],
53
- 'hvcurveto': [31]
41
+ hstem: [1],
42
+ vstem: [3],
43
+ vmoveto: [4],
44
+ rlineto: [5],
45
+ hlineto: [6],
46
+ vlineto: [7],
47
+ rrcurveto: [8],
48
+ callsubr: [10],
49
+ flex: [12, 35],
50
+ drop: [12, 18],
51
+ endchar: [14],
52
+ rmoveto: [21],
53
+ hmoveto: [22],
54
+ vhcurveto: [30],
55
+ hvcurveto: [31]
54
56
  };
55
57
 
56
58
  function Type1CharString() {
@@ -215,7 +217,9 @@ var Type1CharString = function Type1CharStringClosure() {
215
217
 
216
218
  case (12 << 8) + 6:
217
219
  if (seacAnalysisEnabled) {
220
+ const asb = this.stack[this.stack.length - 5];
218
221
  this.seac = this.stack.splice(-4, 4);
222
+ this.seac[0] += this.lsb - asb;
219
223
  error = this.executeCommand(0, COMMAND_MAP.endchar);
220
224
  } else {
221
225
  error = this.executeCommand(4, COMMAND_MAP.endchar);
@@ -303,7 +307,8 @@ var Type1CharString = function Type1CharStringClosure() {
303
307
 
304
308
  return error;
305
309
  },
306
- executeCommand: function executeCommand(howManyArgs, command, keepStack) {
310
+
311
+ executeCommand(howManyArgs, command, keepStack) {
307
312
  var stackLength = this.stack.length;
308
313
 
309
314
  if (howManyArgs > stackLength) {
@@ -319,7 +324,7 @@ var Type1CharString = function Type1CharStringClosure() {
319
324
  this.output.push(28, value >> 8 & 0xff, value & 0xff);
320
325
  } else {
321
326
  value = 65536 * value | 0;
322
- this.output.push(255, value >> 24 & 0xFF, value >> 16 & 0xFF, value >> 8 & 0xFF, value & 0xFF);
327
+ this.output.push(255, value >> 24 & 0xff, value >> 16 & 0xff, value >> 8 & 0xff, value & 0xff);
323
328
  }
324
329
  }
325
330
 
@@ -333,6 +338,7 @@ var Type1CharString = function Type1CharStringClosure() {
333
338
 
334
339
  return false;
335
340
  }
341
+
336
342
  };
337
343
  return Type1CharString;
338
344
  }();
@@ -402,17 +408,17 @@ var Type1Parser = function Type1ParserClosure() {
402
408
  }
403
409
  }
404
410
 
405
- return Array.prototype.slice.call(decrypted, discardNumber, j);
411
+ return decrypted.slice(discardNumber, j);
406
412
  }
407
413
 
408
414
  function isSpecial(c) {
409
- return c === 0x2F || c === 0x5B || c === 0x5D || c === 0x7B || c === 0x7D || c === 0x28 || c === 0x29;
415
+ return c === 0x2f || c === 0x5b || c === 0x5d || c === 0x7b || c === 0x7d || c === 0x28 || c === 0x29;
410
416
  }
411
417
 
412
418
  function Type1Parser(stream, encrypted, seacAnalysisEnabled) {
413
419
  if (encrypted) {
414
420
  var data = stream.getBytes();
415
- var isBinary = !(isHexDigit(data[0]) && isHexDigit(data[1]) && isHexDigit(data[2]) && isHexDigit(data[3]));
421
+ var isBinary = !((isHexDigit(data[0]) || (0, _core_utils.isWhiteSpace)(data[0])) && isHexDigit(data[1]) && isHexDigit(data[2]) && isHexDigit(data[3]) && isHexDigit(data[4]) && isHexDigit(data[5]) && isHexDigit(data[6]) && isHexDigit(data[7]));
416
422
  stream = new _stream.Stream(isBinary ? decrypt(data, EEXEC_ENCRYPT_KEY, 4) : decryptAscii(data, EEXEC_ENCRYPT_KEY, 4));
417
423
  }
418
424
 
@@ -429,7 +435,7 @@ var Type1Parser = function Type1ParserClosure() {
429
435
  while (true) {
430
436
  var token = this.getToken();
431
437
 
432
- if (token === null || token === ']' || token === '}') {
438
+ if (token === null || token === "]" || token === "}") {
433
439
  break;
434
440
  }
435
441
 
@@ -448,7 +454,7 @@ var Type1Parser = function Type1ParserClosure() {
448
454
  },
449
455
  readBoolean: function Type1Parser_readBoolean() {
450
456
  var token = this.getToken();
451
- return token === 'true' ? 1 : 0;
457
+ return token === "true" ? 1 : 0;
452
458
  },
453
459
  nextChar: function Type1_nextChar() {
454
460
  return this.currentChar = this.stream.getByte();
@@ -463,12 +469,12 @@ var Type1Parser = function Type1ParserClosure() {
463
469
  }
464
470
 
465
471
  if (comment) {
466
- if (ch === 0x0A || ch === 0x0D) {
472
+ if (ch === 0x0a || ch === 0x0d) {
467
473
  comment = false;
468
474
  }
469
475
  } else if (ch === 0x25) {
470
476
  comment = true;
471
- } else if (!(0, _util.isSpace)(ch)) {
477
+ } else if (!(0, _core_utils.isWhiteSpace)(ch)) {
472
478
  break;
473
479
  }
474
480
 
@@ -480,12 +486,12 @@ var Type1Parser = function Type1ParserClosure() {
480
486
  return String.fromCharCode(ch);
481
487
  }
482
488
 
483
- var token = '';
489
+ var token = "";
484
490
 
485
491
  do {
486
492
  token += String.fromCharCode(ch);
487
493
  ch = this.nextChar();
488
- } while (ch >= 0 && !(0, _util.isSpace)(ch) && !isSpecial(ch));
494
+ } while (ch >= 0 && !(0, _core_utils.isWhiteSpace)(ch) && !isSpecial(ch));
489
495
 
490
496
  return token;
491
497
  },
@@ -496,30 +502,30 @@ var Type1Parser = function Type1ParserClosure() {
496
502
 
497
503
  return decrypt(bytes, CHAR_STRS_ENCRYPT_KEY, lenIV);
498
504
  },
499
- extractFontProgram: function Type1Parser_extractFontProgram() {
505
+ extractFontProgram: function Type1Parser_extractFontProgram(properties) {
500
506
  var stream = this.stream;
501
507
  var subrs = [],
502
508
  charstrings = [];
503
509
  var privateData = Object.create(null);
504
- privateData['lenIV'] = 4;
510
+ privateData.lenIV = 4;
505
511
  var program = {
506
512
  subrs: [],
507
513
  charstrings: [],
508
514
  properties: {
509
- 'privateData': privateData
515
+ privateData
510
516
  }
511
517
  };
512
518
  var token, length, data, lenIV, encoded;
513
519
 
514
520
  while ((token = this.getToken()) !== null) {
515
- if (token !== '/') {
521
+ if (token !== "/") {
516
522
  continue;
517
523
  }
518
524
 
519
525
  token = this.getToken();
520
526
 
521
527
  switch (token) {
522
- case 'CharStrings':
528
+ case "CharStrings":
523
529
  this.getToken();
524
530
  this.getToken();
525
531
  this.getToken();
@@ -528,11 +534,11 @@ var Type1Parser = function Type1ParserClosure() {
528
534
  while (true) {
529
535
  token = this.getToken();
530
536
 
531
- if (token === null || token === 'end') {
537
+ if (token === null || token === "end") {
532
538
  break;
533
539
  }
534
540
 
535
- if (token !== '/') {
541
+ if (token !== "/") {
536
542
  continue;
537
543
  }
538
544
 
@@ -540,38 +546,38 @@ var Type1Parser = function Type1ParserClosure() {
540
546
  length = this.readInt();
541
547
  this.getToken();
542
548
  data = length > 0 ? stream.getBytes(length) : new Uint8Array(0);
543
- lenIV = program.properties.privateData['lenIV'];
549
+ lenIV = program.properties.privateData.lenIV;
544
550
  encoded = this.readCharStrings(data, lenIV);
545
551
  this.nextChar();
546
552
  token = this.getToken();
547
553
 
548
- if (token === 'noaccess') {
554
+ if (token === "noaccess") {
549
555
  this.getToken();
550
556
  }
551
557
 
552
558
  charstrings.push({
553
- glyph: glyph,
554
- encoded: encoded
559
+ glyph,
560
+ encoded
555
561
  });
556
562
  }
557
563
 
558
564
  break;
559
565
 
560
- case 'Subrs':
566
+ case "Subrs":
561
567
  this.readInt();
562
568
  this.getToken();
563
569
 
564
- while (this.getToken() === 'dup') {
565
- var index = this.readInt();
570
+ while (this.getToken() === "dup") {
571
+ const index = this.readInt();
566
572
  length = this.readInt();
567
573
  this.getToken();
568
574
  data = length > 0 ? stream.getBytes(length) : new Uint8Array(0);
569
- lenIV = program.properties.privateData['lenIV'];
575
+ lenIV = program.properties.privateData.lenIV;
570
576
  encoded = this.readCharStrings(data, lenIV);
571
577
  this.nextChar();
572
578
  token = this.getToken();
573
579
 
574
- if (token === 'noaccess') {
580
+ if (token === "noaccess") {
575
581
  this.getToken();
576
582
  }
577
583
 
@@ -580,10 +586,10 @@ var Type1Parser = function Type1ParserClosure() {
580
586
 
581
587
  break;
582
588
 
583
- case 'BlueValues':
584
- case 'OtherBlues':
585
- case 'FamilyBlues':
586
- case 'FamilyOtherBlues':
589
+ case "BlueValues":
590
+ case "OtherBlues":
591
+ case "FamilyBlues":
592
+ case "FamilyOtherBlues":
587
593
  var blueArray = this.readNumberArray();
588
594
 
589
595
  if (blueArray.length > 0 && blueArray.length % 2 === 0 && HINTING_ENABLED) {
@@ -592,26 +598,26 @@ var Type1Parser = function Type1ParserClosure() {
592
598
 
593
599
  break;
594
600
 
595
- case 'StemSnapH':
596
- case 'StemSnapV':
601
+ case "StemSnapH":
602
+ case "StemSnapV":
597
603
  program.properties.privateData[token] = this.readNumberArray();
598
604
  break;
599
605
 
600
- case 'StdHW':
601
- case 'StdVW':
606
+ case "StdHW":
607
+ case "StdVW":
602
608
  program.properties.privateData[token] = this.readNumberArray()[0];
603
609
  break;
604
610
 
605
- case 'BlueShift':
606
- case 'lenIV':
607
- case 'BlueFuzz':
608
- case 'BlueScale':
609
- case 'LanguageGroup':
610
- case 'ExpansionFactor':
611
+ case "BlueShift":
612
+ case "lenIV":
613
+ case "BlueFuzz":
614
+ case "BlueScale":
615
+ case "LanguageGroup":
616
+ case "ExpansionFactor":
611
617
  program.properties.privateData[token] = this.readNumber();
612
618
  break;
613
619
 
614
- case 'ForceBold':
620
+ case "ForceBold":
615
621
  program.properties.privateData[token] = this.readBoolean();
616
622
  break;
617
623
  }
@@ -628,13 +634,27 @@ var Type1Parser = function Type1ParserClosure() {
628
634
  output = [14];
629
635
  }
630
636
 
631
- program.charstrings.push({
637
+ const charStringObject = {
632
638
  glyphName: glyph,
633
639
  charstring: output,
634
640
  width: charString.width,
635
641
  lsb: charString.lsb,
636
642
  seac: charString.seac
637
- });
643
+ };
644
+
645
+ if (glyph === ".notdef") {
646
+ program.charstrings.unshift(charStringObject);
647
+ } else {
648
+ program.charstrings.push(charStringObject);
649
+ }
650
+
651
+ if (properties.builtInEncoding) {
652
+ const index = properties.builtInEncoding.indexOf(glyph);
653
+
654
+ if (index > -1 && properties.widths[index] === undefined && index >= properties.firstChar && index <= properties.lastChar) {
655
+ properties.widths[index] = charString.width;
656
+ }
657
+ }
638
658
  }
639
659
 
640
660
  return program;
@@ -643,19 +663,19 @@ var Type1Parser = function Type1ParserClosure() {
643
663
  var token;
644
664
 
645
665
  while ((token = this.getToken()) !== null) {
646
- if (token !== '/') {
666
+ if (token !== "/") {
647
667
  continue;
648
668
  }
649
669
 
650
670
  token = this.getToken();
651
671
 
652
672
  switch (token) {
653
- case 'FontMatrix':
673
+ case "FontMatrix":
654
674
  var matrix = this.readNumberArray();
655
675
  properties.fontMatrix = matrix;
656
676
  break;
657
677
 
658
- case 'Encoding':
678
+ case "Encoding":
659
679
  var encodingArg = this.getToken();
660
680
  var encoding;
661
681
 
@@ -669,7 +689,7 @@ var Type1Parser = function Type1ParserClosure() {
669
689
  for (var j = 0; j < size; j++) {
670
690
  token = this.getToken();
671
691
 
672
- while (token !== 'dup' && token !== 'def') {
692
+ while (token !== "dup" && token !== "def") {
673
693
  token = this.getToken();
674
694
 
675
695
  if (token === null) {
@@ -677,7 +697,7 @@ var Type1Parser = function Type1ParserClosure() {
677
697
  }
678
698
  }
679
699
 
680
- if (token === 'def') {
700
+ if (token === "def") {
681
701
  break;
682
702
  }
683
703
 
@@ -692,7 +712,7 @@ var Type1Parser = function Type1ParserClosure() {
692
712
  properties.builtInEncoding = encoding;
693
713
  break;
694
714
 
695
- case 'FontBBox':
715
+ case "FontBBox":
696
716
  var fontBBox = this.readNumberArray();
697
717
  properties.ascent = Math.max(fontBBox[3], fontBBox[1]);
698
718
  properties.descent = Math.min(fontBBox[1], fontBBox[3]);