pdfjs-dist 2.3.200 → 2.4.456

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 (185) hide show
  1. package/README.md +4 -0
  2. package/bower.json +1 -1
  3. package/build/pdf.js +6499 -17971
  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 +19303 -29896
  8. package/build/pdf.worker.js.map +1 -1
  9. package/build/pdf.worker.min.js +22 -1
  10. package/es5/build/pdf.js +25473 -0
  11. package/es5/build/pdf.js.map +1 -0
  12. package/{lib/shared/global_scope.js → es5/build/pdf.worker.entry.js} +5 -10
  13. package/es5/build/pdf.worker.js +57878 -0
  14. package/es5/build/pdf.worker.js.map +1 -0
  15. package/es5/web/images/annotation-check.svg +11 -0
  16. package/es5/web/images/annotation-comment.svg +16 -0
  17. package/es5/web/images/annotation-help.svg +26 -0
  18. package/es5/web/images/annotation-insert.svg +10 -0
  19. package/es5/web/images/annotation-key.svg +11 -0
  20. package/es5/web/images/annotation-newparagraph.svg +11 -0
  21. package/es5/web/images/annotation-noicon.svg +7 -0
  22. package/es5/web/images/annotation-note.svg +42 -0
  23. package/es5/web/images/annotation-paragraph.svg +16 -0
  24. package/es5/web/images/loading-icon.gif +0 -0
  25. package/es5/web/images/shadow.png +0 -0
  26. package/es5/web/images/texture.png +0 -0
  27. package/es5/web/pdf_viewer.css +407 -0
  28. package/es5/web/pdf_viewer.js +7757 -0
  29. package/es5/web/pdf_viewer.js.map +1 -0
  30. package/image_decoders/pdf.image_decoders.js +1333 -4839
  31. package/image_decoders/pdf.image_decoders.js.map +1 -1
  32. package/image_decoders/pdf.image_decoders.min.js +22 -1
  33. package/lib/README.md +7 -0
  34. package/lib/core/annotation.js +683 -1066
  35. package/lib/core/arithmetic_decoder.js +81 -97
  36. package/lib/core/bidi.js +54 -46
  37. package/lib/core/ccitt.js +88 -81
  38. package/lib/core/ccitt_stream.js +15 -14
  39. package/lib/core/cff_parser.js +196 -193
  40. package/lib/core/charsets.js +4 -4
  41. package/lib/core/chunked_stream.js +441 -569
  42. package/lib/core/cmap.js +220 -279
  43. package/lib/core/colorspace.js +699 -863
  44. package/lib/core/core_utils.js +59 -80
  45. package/lib/core/crypto.js +379 -437
  46. package/lib/core/document.js +564 -673
  47. package/lib/core/encodings.js +15 -15
  48. package/lib/core/evaluator.js +983 -889
  49. package/lib/core/font_renderer.js +128 -171
  50. package/lib/core/fonts.js +451 -400
  51. package/lib/core/function.js +289 -285
  52. package/lib/core/glyphlist.js +4527 -4527
  53. package/lib/core/image.js +138 -117
  54. package/lib/core/image_utils.js +46 -63
  55. package/lib/core/jbig2.js +324 -332
  56. package/lib/core/jbig2_stream.js +18 -17
  57. package/lib/core/jpeg_stream.js +133 -24
  58. package/lib/core/jpg.js +238 -210
  59. package/lib/core/jpx.js +158 -157
  60. package/lib/core/jpx_stream.js +28 -28
  61. package/lib/core/metrics.js +2928 -2928
  62. package/lib/core/murmurhash3.js +87 -102
  63. package/lib/core/obj.js +1111 -1302
  64. package/lib/core/operator_list.js +55 -42
  65. package/lib/core/parser.js +956 -987
  66. package/lib/core/pattern.js +69 -69
  67. package/lib/core/pdf_manager.js +149 -316
  68. package/lib/core/primitives.js +45 -77
  69. package/lib/core/ps_parser.js +175 -214
  70. package/lib/core/standard_fonts.js +237 -236
  71. package/lib/core/stream.js +83 -77
  72. package/lib/core/type1_parser.js +78 -68
  73. package/lib/core/unicode.js +1654 -1654
  74. package/lib/core/worker.js +148 -196
  75. package/lib/core/worker_stream.js +101 -210
  76. package/lib/display/annotation_layer.js +733 -1155
  77. package/lib/display/api.js +1539 -1928
  78. package/lib/display/api_compatibility.js +10 -8
  79. package/lib/display/canvas.js +159 -158
  80. package/lib/display/content_disposition.js +36 -55
  81. package/lib/display/display_utils.js +298 -551
  82. package/lib/display/fetch_stream.js +181 -305
  83. package/lib/display/font_loader.js +273 -416
  84. package/lib/display/metadata.js +86 -98
  85. package/lib/display/network.js +376 -511
  86. package/lib/display/network_utils.js +20 -19
  87. package/lib/display/node_stream.js +276 -460
  88. package/lib/display/pattern_helper.js +76 -44
  89. package/lib/display/svg.js +1137 -1405
  90. package/lib/display/text_layer.js +75 -82
  91. package/lib/display/transport_stream.js +236 -374
  92. package/lib/display/webgl.js +70 -83
  93. package/lib/display/worker_options.js +3 -3
  94. package/lib/display/xml_parser.js +303 -392
  95. package/lib/examples/node/domstubs.js +37 -37
  96. package/lib/pdf.js +22 -21
  97. package/lib/pdf.worker.js +5 -5
  98. package/lib/shared/compatibility.js +2 -251
  99. package/lib/shared/is_node.js +7 -6
  100. package/lib/shared/message_handler.js +222 -194
  101. package/lib/shared/util.js +269 -405
  102. package/lib/test/unit/annotation_spec.js +1089 -1014
  103. package/lib/test/unit/api_spec.js +617 -544
  104. package/lib/test/unit/bidi_spec.js +7 -7
  105. package/lib/test/unit/cff_parser_spec.js +63 -62
  106. package/lib/test/unit/clitests_helper.js +7 -9
  107. package/lib/test/unit/cmap_spec.js +84 -86
  108. package/lib/test/unit/colorspace_spec.js +154 -154
  109. package/lib/test/unit/core_utils_spec.js +125 -105
  110. package/lib/test/unit/crypto_spec.js +181 -181
  111. package/lib/test/unit/custom_spec.js +22 -24
  112. package/lib/test/unit/display_svg_spec.js +35 -36
  113. package/lib/test/unit/display_utils_spec.js +139 -149
  114. package/lib/test/unit/document_spec.js +16 -16
  115. package/lib/test/unit/encodings_spec.js +12 -34
  116. package/lib/test/unit/evaluator_spec.js +81 -95
  117. package/lib/test/unit/fetch_stream_spec.js +30 -30
  118. package/lib/test/unit/function_spec.js +206 -204
  119. package/lib/test/unit/jasmine-boot.js +48 -32
  120. package/lib/test/unit/message_handler_spec.js +172 -162
  121. package/lib/test/unit/metadata_spec.js +69 -69
  122. package/lib/test/unit/murmurhash3_spec.js +12 -12
  123. package/lib/test/unit/network_spec.js +12 -12
  124. package/lib/test/unit/network_utils_spec.js +152 -152
  125. package/lib/test/unit/node_stream_spec.js +74 -90
  126. package/lib/test/unit/parser_spec.js +107 -113
  127. package/lib/test/unit/pdf_find_controller_spec.js +55 -86
  128. package/lib/test/unit/pdf_find_utils_spec.js +32 -32
  129. package/lib/test/unit/pdf_history_spec.js +32 -32
  130. package/lib/test/unit/primitives_spec.js +117 -115
  131. package/lib/test/unit/stream_spec.js +16 -14
  132. package/lib/test/unit/test_utils.js +119 -285
  133. package/lib/test/unit/testreporter.js +19 -19
  134. package/lib/test/unit/type1_parser_spec.js +41 -41
  135. package/lib/test/unit/ui_utils_spec.js +318 -426
  136. package/lib/test/unit/unicode_spec.js +42 -42
  137. package/lib/test/unit/util_spec.js +122 -143
  138. package/lib/web/annotation_layer_builder.js +66 -103
  139. package/lib/web/app.js +1166 -1196
  140. package/lib/web/app_options.js +61 -77
  141. package/lib/web/base_viewer.js +804 -850
  142. package/lib/web/chromecom.js +164 -249
  143. package/lib/web/debugger.js +149 -205
  144. package/lib/web/download_manager.js +38 -57
  145. package/lib/web/firefox_print_service.js +35 -30
  146. package/lib/web/firefoxcom.js +175 -374
  147. package/lib/web/genericcom.js +26 -108
  148. package/lib/web/genericl10n.js +24 -153
  149. package/lib/web/grab_to_pan.js +30 -30
  150. package/lib/web/interfaces.js +80 -258
  151. package/lib/web/overlay_manager.js +70 -246
  152. package/lib/web/password_prompt.js +38 -64
  153. package/lib/web/pdf_attachment_viewer.js +105 -130
  154. package/lib/web/pdf_cursor_tools.js +75 -102
  155. package/lib/web/pdf_document_properties.js +227 -376
  156. package/lib/web/pdf_find_bar.js +137 -171
  157. package/lib/web/pdf_find_controller.js +492 -549
  158. package/lib/web/pdf_find_utils.js +13 -13
  159. package/lib/web/pdf_history.js +395 -406
  160. package/lib/web/pdf_link_service.js +302 -349
  161. package/lib/web/pdf_outline_viewer.js +148 -209
  162. package/lib/web/pdf_page_view.js +449 -507
  163. package/lib/web/pdf_presentation_mode.js +304 -357
  164. package/lib/web/pdf_print_service.js +90 -104
  165. package/lib/web/pdf_rendering_queue.js +87 -108
  166. package/lib/web/pdf_sidebar.js +264 -304
  167. package/lib/web/pdf_sidebar_resizer.js +92 -119
  168. package/lib/web/pdf_single_page_viewer.js +77 -126
  169. package/lib/web/pdf_thumbnail_view.js +276 -297
  170. package/lib/web/pdf_thumbnail_viewer.js +186 -206
  171. package/lib/web/pdf_viewer.component.js +20 -21
  172. package/lib/web/pdf_viewer.js +55 -115
  173. package/lib/web/preferences.js +66 -273
  174. package/lib/web/secondary_toolbar.js +164 -196
  175. package/lib/web/text_layer_builder.js +284 -317
  176. package/lib/web/toolbar.js +216 -211
  177. package/lib/web/ui_utils.js +303 -404
  178. package/lib/web/view_history.js +49 -222
  179. package/lib/web/viewer_compatibility.js +7 -5
  180. package/package.json +2 -9
  181. package/web/pdf_viewer.css +25 -18
  182. package/web/pdf_viewer.js +3481 -4764
  183. package/web/pdf_viewer.js.map +1 -1
  184. package/webpack.js +14 -5
  185. package/lib/shared/streams_polyfill.js +0 -43
@@ -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,33 +26,15 @@ Object.defineProperty(exports, "__esModule", {
26
26
  });
27
27
  exports.FontRendererFactory = void 0;
28
28
 
29
- var _util = require("../shared/util");
29
+ var _util = require("../shared/util.js");
30
30
 
31
- var _cff_parser = require("./cff_parser");
31
+ var _cff_parser = require("./cff_parser.js");
32
32
 
33
- var _glyphlist = require("./glyphlist");
33
+ var _glyphlist = require("./glyphlist.js");
34
34
 
35
- var _encodings = require("./encodings");
35
+ var _encodings = require("./encodings.js");
36
36
 
37
- var _stream = require("./stream");
38
-
39
- function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
40
-
41
- function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); }
42
-
43
- function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
44
-
45
- function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
46
-
47
- function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); }
48
-
49
- function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
50
-
51
- function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
52
-
53
- function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
54
-
55
- function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
37
+ var _stream = require("./stream.js");
56
38
 
57
39
  var FontRendererFactory = function FontRendererFactoryClosure() {
58
40
  function getLong(data, offset) {
@@ -63,6 +45,19 @@ var FontRendererFactory = function FontRendererFactoryClosure() {
63
45
  return data[offset] << 8 | data[offset + 1];
64
46
  }
65
47
 
48
+ function getSubroutineBias(subrs) {
49
+ const numSubrs = subrs.length;
50
+ let bias = 32768;
51
+
52
+ if (numSubrs < 1240) {
53
+ bias = 107;
54
+ } else if (numSubrs < 33900) {
55
+ bias = 1131;
56
+ }
57
+
58
+ return bias;
59
+ }
60
+
66
61
  function parseCmap(data, start, end) {
67
62
  var offset = getUshort(data, start + 2) === 1 ? getLong(data, start + 8) : getLong(data, start + 16);
68
63
  var format = getUshort(data, start + offset);
@@ -124,7 +119,7 @@ var FontRendererFactory = function FontRendererFactoryClosure() {
124
119
  return ranges;
125
120
  }
126
121
 
127
- throw new _util.FormatError("unsupported cmap: ".concat(format));
122
+ throw new _util.FormatError(`unsupported cmap: ${format}`);
128
123
  }
129
124
 
130
125
  function parseCff(data, start, end, seacAnalysisEnabled) {
@@ -187,7 +182,7 @@ var FontRendererFactory = function FontRendererFactoryClosure() {
187
182
  }
188
183
 
189
184
  if (ranges[l].start <= code && code <= ranges[l].end) {
190
- gid = ranges[l].idDelta + (ranges[l].ids ? ranges[l].ids[code - ranges[l].start] : code) & 0xFFFF;
185
+ gid = ranges[l].idDelta + (ranges[l].ids ? ranges[l].ids[code - ranges[l].start] : code) & 0xffff;
191
186
  }
192
187
 
193
188
  return {
@@ -199,21 +194,21 @@ var FontRendererFactory = function FontRendererFactoryClosure() {
199
194
  function compileGlyf(code, cmds, font) {
200
195
  function moveTo(x, y) {
201
196
  cmds.push({
202
- cmd: 'moveTo',
197
+ cmd: "moveTo",
203
198
  args: [x, y]
204
199
  });
205
200
  }
206
201
 
207
202
  function lineTo(x, y) {
208
203
  cmds.push({
209
- cmd: 'lineTo',
204
+ cmd: "lineTo",
210
205
  args: [x, y]
211
206
  });
212
207
  }
213
208
 
214
209
  function quadraticCurveTo(xa, ya, x, y) {
215
210
  cmds.push({
216
- cmd: 'quadraticCurveTo',
211
+ cmd: "quadraticCurveTo",
217
212
  args: [xa, ya, x, y]
218
213
  });
219
214
  }
@@ -273,15 +268,15 @@ var FontRendererFactory = function FontRendererFactoryClosure() {
273
268
 
274
269
  if (subglyph) {
275
270
  cmds.push({
276
- cmd: 'save'
271
+ cmd: "save"
277
272
  });
278
273
  cmds.push({
279
- cmd: 'transform',
274
+ cmd: "transform",
280
275
  args: [scaleX, scale01, scale10, scaleY, x, y]
281
276
  });
282
277
  compileGlyf(subglyph, cmds, font);
283
278
  cmds.push({
284
- cmd: 'restore'
279
+ cmd: "restore"
285
280
  });
286
281
  }
287
282
  } while (flags & 0x20);
@@ -309,7 +304,7 @@ var FontRendererFactory = function FontRendererFactoryClosure() {
309
304
 
310
305
  while (repeat-- > 0) {
311
306
  points.push({
312
- flags: flags
307
+ flags
313
308
  });
314
309
  }
315
310
  }
@@ -398,21 +393,21 @@ var FontRendererFactory = function FontRendererFactoryClosure() {
398
393
 
399
394
  function moveTo(x, y) {
400
395
  cmds.push({
401
- cmd: 'moveTo',
396
+ cmd: "moveTo",
402
397
  args: [x, y]
403
398
  });
404
399
  }
405
400
 
406
401
  function lineTo(x, y) {
407
402
  cmds.push({
408
- cmd: 'lineTo',
403
+ cmd: "lineTo",
409
404
  args: [x, y]
410
405
  });
411
406
  }
412
407
 
413
408
  function bezierCurveTo(x1, y1, x2, y2, x, y) {
414
409
  cmds.push({
415
- cmd: 'bezierCurveTo',
410
+ cmd: "bezierCurveTo",
416
411
  args: [x1, y1, x2, y2, x, y]
417
412
  });
418
413
  }
@@ -499,23 +494,22 @@ var FontRendererFactory = function FontRendererFactoryClosure() {
499
494
  subrCode = null;
500
495
 
501
496
  if (font.isCFFCIDFont) {
502
- var fdIndex = font.fdSelect.getFDIndex(glyphId);
497
+ const fdIndex = font.fdSelect.getFDIndex(glyphId);
503
498
 
504
499
  if (fdIndex >= 0 && fdIndex < font.fdArray.length) {
505
- var fontDict = font.fdArray[fdIndex],
506
- subrs = void 0;
500
+ const fontDict = font.fdArray[fdIndex];
501
+ let subrs;
507
502
 
508
503
  if (fontDict.privateDict && fontDict.privateDict.subrsIndex) {
509
504
  subrs = fontDict.privateDict.subrsIndex.objects;
510
505
  }
511
506
 
512
507
  if (subrs) {
513
- var numSubrs = subrs.length;
514
- n += numSubrs < 1240 ? 107 : numSubrs < 33900 ? 1131 : 32768;
508
+ n += getSubroutineBias(subrs);
515
509
  subrCode = subrs[n];
516
510
  }
517
511
  } else {
518
- (0, _util.warn)('Invalid fd index for glyph index.');
512
+ (0, _util.warn)("Invalid fd index for glyph index.");
519
513
  }
520
514
  } else {
521
515
  subrCode = font.subrs[n + font.subrsBias];
@@ -605,7 +599,7 @@ var FontRendererFactory = function FontRendererFactoryClosure() {
605
599
  break;
606
600
 
607
601
  default:
608
- throw new _util.FormatError("unknown operator: 12 ".concat(v));
602
+ throw new _util.FormatError(`unknown operator: 12 ${v}`);
609
603
  }
610
604
 
611
605
  break;
@@ -617,16 +611,16 @@ var FontRendererFactory = function FontRendererFactoryClosure() {
617
611
  y = stack.pop();
618
612
  x = stack.pop();
619
613
  cmds.push({
620
- cmd: 'save'
614
+ cmd: "save"
621
615
  });
622
616
  cmds.push({
623
- cmd: 'translate',
617
+ cmd: "translate",
624
618
  args: [x, y]
625
619
  });
626
620
  var cmap = lookupCmap(font.cmap, String.fromCharCode(font.glyphNameMap[_encodings.StandardEncoding[achar]]));
627
621
  compileCharString(font.glyphs[cmap.glyphId], cmds, font, cmap.glyphId);
628
622
  cmds.push({
629
- cmd: 'restore'
623
+ cmd: "restore"
630
624
  });
631
625
  cmap = lookupCmap(font.cmap, String.fromCharCode(font.glyphNameMap[_encodings.StandardEncoding[bchar]]));
632
626
  compileCharString(font.glyphs[cmap.glyphId], cmds, font, cmap.glyphId);
@@ -802,7 +796,7 @@ var FontRendererFactory = function FontRendererFactoryClosure() {
802
796
 
803
797
  default:
804
798
  if (v < 32) {
805
- throw new _util.FormatError("unknown operator: ".concat(v));
799
+ throw new _util.FormatError(`unknown operator: ${v}`);
806
800
  }
807
801
 
808
802
  if (v < 247) {
@@ -828,16 +822,12 @@ var FontRendererFactory = function FontRendererFactoryClosure() {
828
822
  parse(code);
829
823
  }
830
824
 
831
- var NOOP = [];
832
-
833
- var CompiledFont =
834
- /*#__PURE__*/
835
- function () {
836
- function CompiledFont(fontMatrix) {
837
- _classCallCheck(this, CompiledFont);
825
+ const NOOP = [];
838
826
 
827
+ class CompiledFont {
828
+ constructor(fontMatrix) {
839
829
  if (this.constructor === CompiledFont) {
840
- (0, _util.unreachable)('Cannot initialize CompiledFont.');
830
+ (0, _util.unreachable)("Cannot initialize CompiledFont.");
841
831
  }
842
832
 
843
833
  this.fontMatrix = fontMatrix;
@@ -845,136 +835,103 @@ var FontRendererFactory = function FontRendererFactoryClosure() {
845
835
  this.compiledCharCodeToGlyphId = Object.create(null);
846
836
  }
847
837
 
848
- _createClass(CompiledFont, [{
849
- key: "getPathJs",
850
- value: function getPathJs(unicode) {
851
- var cmap = lookupCmap(this.cmap, unicode);
852
- var fn = this.compiledGlyphs[cmap.glyphId];
838
+ getPathJs(unicode) {
839
+ const cmap = lookupCmap(this.cmap, unicode);
840
+ let fn = this.compiledGlyphs[cmap.glyphId];
853
841
 
854
- if (!fn) {
855
- fn = this.compileGlyph(this.glyphs[cmap.glyphId], cmap.glyphId);
856
- this.compiledGlyphs[cmap.glyphId] = fn;
857
- }
842
+ if (!fn) {
843
+ fn = this.compileGlyph(this.glyphs[cmap.glyphId], cmap.glyphId);
844
+ this.compiledGlyphs[cmap.glyphId] = fn;
845
+ }
858
846
 
859
- if (this.compiledCharCodeToGlyphId[cmap.charCode] === undefined) {
860
- this.compiledCharCodeToGlyphId[cmap.charCode] = cmap.glyphId;
861
- }
847
+ if (this.compiledCharCodeToGlyphId[cmap.charCode] === undefined) {
848
+ this.compiledCharCodeToGlyphId[cmap.charCode] = cmap.glyphId;
849
+ }
862
850
 
863
- return fn;
851
+ return fn;
852
+ }
853
+
854
+ compileGlyph(code, glyphId) {
855
+ if (!code || code.length === 0 || code[0] === 14) {
856
+ return NOOP;
864
857
  }
865
- }, {
866
- key: "compileGlyph",
867
- value: function compileGlyph(code, glyphId) {
868
- if (!code || code.length === 0 || code[0] === 14) {
869
- return NOOP;
870
- }
871
858
 
872
- var fontMatrix = this.fontMatrix;
859
+ let fontMatrix = this.fontMatrix;
873
860
 
874
- if (this.isCFFCIDFont) {
875
- var fdIndex = this.fdSelect.getFDIndex(glyphId);
861
+ if (this.isCFFCIDFont) {
862
+ const fdIndex = this.fdSelect.getFDIndex(glyphId);
876
863
 
877
- if (fdIndex >= 0 && fdIndex < this.fdArray.length) {
878
- var fontDict = this.fdArray[fdIndex];
879
- fontMatrix = fontDict.getByName('FontMatrix') || _util.FONT_IDENTITY_MATRIX;
880
- } else {
881
- (0, _util.warn)('Invalid fd index for glyph index.');
882
- }
864
+ if (fdIndex >= 0 && fdIndex < this.fdArray.length) {
865
+ const fontDict = this.fdArray[fdIndex];
866
+ fontMatrix = fontDict.getByName("FontMatrix") || _util.FONT_IDENTITY_MATRIX;
867
+ } else {
868
+ (0, _util.warn)("Invalid fd index for glyph index.");
883
869
  }
884
-
885
- var cmds = [];
886
- cmds.push({
887
- cmd: 'save'
888
- });
889
- cmds.push({
890
- cmd: 'transform',
891
- args: fontMatrix.slice()
892
- });
893
- cmds.push({
894
- cmd: 'scale',
895
- args: ['size', '-size']
896
- });
897
- this.compileGlyphImpl(code, cmds, glyphId);
898
- cmds.push({
899
- cmd: 'restore'
900
- });
901
- return cmds;
902
870
  }
903
- }, {
904
- key: "compileGlyphImpl",
905
- value: function compileGlyphImpl() {
906
- (0, _util.unreachable)('Children classes should implement this.');
907
- }
908
- }, {
909
- key: "hasBuiltPath",
910
- value: function hasBuiltPath(unicode) {
911
- var cmap = lookupCmap(this.cmap, unicode);
912
- return this.compiledGlyphs[cmap.glyphId] !== undefined && this.compiledCharCodeToGlyphId[cmap.charCode] !== undefined;
913
- }
914
- }]);
915
871
 
916
- return CompiledFont;
917
- }();
872
+ const cmds = [];
873
+ cmds.push({
874
+ cmd: "save"
875
+ });
876
+ cmds.push({
877
+ cmd: "transform",
878
+ args: fontMatrix.slice()
879
+ });
880
+ cmds.push({
881
+ cmd: "scale",
882
+ args: ["size", "-size"]
883
+ });
884
+ this.compileGlyphImpl(code, cmds, glyphId);
885
+ cmds.push({
886
+ cmd: "restore"
887
+ });
888
+ return cmds;
889
+ }
890
+
891
+ compileGlyphImpl() {
892
+ (0, _util.unreachable)("Children classes should implement this.");
893
+ }
918
894
 
919
- var TrueTypeCompiled =
920
- /*#__PURE__*/
921
- function (_CompiledFont) {
922
- _inherits(TrueTypeCompiled, _CompiledFont);
895
+ hasBuiltPath(unicode) {
896
+ const cmap = lookupCmap(this.cmap, unicode);
897
+ return this.compiledGlyphs[cmap.glyphId] !== undefined && this.compiledCharCodeToGlyphId[cmap.charCode] !== undefined;
898
+ }
923
899
 
924
- function TrueTypeCompiled(glyphs, cmap, fontMatrix) {
925
- var _this;
900
+ }
926
901
 
927
- _classCallCheck(this, TrueTypeCompiled);
902
+ class TrueTypeCompiled extends CompiledFont {
903
+ constructor(glyphs, cmap, fontMatrix) {
904
+ super(fontMatrix || [0.000488, 0, 0, 0.000488, 0, 0]);
905
+ this.glyphs = glyphs;
906
+ this.cmap = cmap;
907
+ }
928
908
 
929
- _this = _possibleConstructorReturn(this, _getPrototypeOf(TrueTypeCompiled).call(this, fontMatrix || [0.000488, 0, 0, 0.000488, 0, 0]));
930
- _this.glyphs = glyphs;
931
- _this.cmap = cmap;
932
- return _this;
909
+ compileGlyphImpl(code, cmds) {
910
+ compileGlyf(code, cmds, this);
933
911
  }
934
912
 
935
- _createClass(TrueTypeCompiled, [{
936
- key: "compileGlyphImpl",
937
- value: function compileGlyphImpl(code, cmds) {
938
- compileGlyf(code, cmds, this);
939
- }
940
- }]);
941
-
942
- return TrueTypeCompiled;
943
- }(CompiledFont);
944
-
945
- var Type2Compiled =
946
- /*#__PURE__*/
947
- function (_CompiledFont2) {
948
- _inherits(Type2Compiled, _CompiledFont2);
949
-
950
- function Type2Compiled(cffInfo, cmap, fontMatrix, glyphNameMap) {
951
- var _this2;
952
-
953
- _classCallCheck(this, Type2Compiled);
954
-
955
- _this2 = _possibleConstructorReturn(this, _getPrototypeOf(Type2Compiled).call(this, fontMatrix || [0.001, 0, 0, 0.001, 0, 0]));
956
- _this2.glyphs = cffInfo.glyphs;
957
- _this2.gsubrs = cffInfo.gsubrs || [];
958
- _this2.subrs = cffInfo.subrs || [];
959
- _this2.cmap = cmap;
960
- _this2.glyphNameMap = glyphNameMap || (0, _glyphlist.getGlyphsUnicode)();
961
- _this2.gsubrsBias = _this2.gsubrs.length < 1240 ? 107 : _this2.gsubrs.length < 33900 ? 1131 : 32768;
962
- _this2.subrsBias = _this2.subrs.length < 1240 ? 107 : _this2.subrs.length < 33900 ? 1131 : 32768;
963
- _this2.isCFFCIDFont = cffInfo.isCFFCIDFont;
964
- _this2.fdSelect = cffInfo.fdSelect;
965
- _this2.fdArray = cffInfo.fdArray;
966
- return _this2;
913
+ }
914
+
915
+ class Type2Compiled extends CompiledFont {
916
+ constructor(cffInfo, cmap, fontMatrix, glyphNameMap) {
917
+ super(fontMatrix || [0.001, 0, 0, 0.001, 0, 0]);
918
+ this.glyphs = cffInfo.glyphs;
919
+ this.gsubrs = cffInfo.gsubrs || [];
920
+ this.subrs = cffInfo.subrs || [];
921
+ this.cmap = cmap;
922
+ this.glyphNameMap = glyphNameMap || (0, _glyphlist.getGlyphsUnicode)();
923
+ this.gsubrsBias = getSubroutineBias(this.gsubrs);
924
+ this.subrsBias = getSubroutineBias(this.subrs);
925
+ this.isCFFCIDFont = cffInfo.isCFFCIDFont;
926
+ this.fdSelect = cffInfo.fdSelect;
927
+ this.fdArray = cffInfo.fdArray;
967
928
  }
968
929
 
969
- _createClass(Type2Compiled, [{
970
- key: "compileGlyphImpl",
971
- value: function compileGlyphImpl(code, cmds, glyphId) {
972
- compileCharString(code, cmds, this, glyphId);
973
- }
974
- }]);
930
+ compileGlyphImpl(code, cmds, glyphId) {
931
+ compileCharString(code, cmds, this, glyphId);
932
+ }
975
933
 
976
- return Type2Compiled;
977
- }(CompiledFont);
934
+ }
978
935
 
979
936
  return {
980
937
  create: function FontRendererFactory_create(font, seacAnalysisEnabled) {
@@ -988,24 +945,24 @@ var FontRendererFactory = function FontRendererFactoryClosure() {
988
945
  var length = getLong(data, p + 12);
989
946
 
990
947
  switch (tag) {
991
- case 'cmap':
948
+ case "cmap":
992
949
  cmap = parseCmap(data, offset, offset + length);
993
950
  break;
994
951
 
995
- case 'glyf':
952
+ case "glyf":
996
953
  glyf = data.subarray(offset, offset + length);
997
954
  break;
998
955
 
999
- case 'loca':
956
+ case "loca":
1000
957
  loca = data.subarray(offset, offset + length);
1001
958
  break;
1002
959
 
1003
- case 'head':
960
+ case "head":
1004
961
  unitsPerEm = getUshort(data, offset + 18);
1005
962
  indexToLocFormat = getUshort(data, offset + 50);
1006
963
  break;
1007
964
 
1008
- case 'CFF ':
965
+ case "CFF ":
1009
966
  cff = parseCff(data, offset, offset + length, seacAnalysisEnabled);
1010
967
  break;
1011
968
  }