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,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
  }
@@ -390,33 +385,33 @@ var FontRendererFactory = function FontRendererFactoryClosure() {
390
385
  }
391
386
  }
392
387
 
393
- function compileCharString(code, cmds, font, glyphId) {
394
- var stack = [];
395
- var x = 0,
396
- y = 0;
397
- var stems = 0;
398
-
388
+ function compileCharString(charStringCode, cmds, font, glyphId) {
399
389
  function moveTo(x, y) {
400
390
  cmds.push({
401
- cmd: 'moveTo',
391
+ cmd: "moveTo",
402
392
  args: [x, y]
403
393
  });
404
394
  }
405
395
 
406
396
  function lineTo(x, y) {
407
397
  cmds.push({
408
- cmd: 'lineTo',
398
+ cmd: "lineTo",
409
399
  args: [x, y]
410
400
  });
411
401
  }
412
402
 
413
403
  function bezierCurveTo(x1, y1, x2, y2, x, y) {
414
404
  cmds.push({
415
- cmd: 'bezierCurveTo',
405
+ cmd: "bezierCurveTo",
416
406
  args: [x1, y1, x2, y2, x, y]
417
407
  });
418
408
  }
419
409
 
410
+ var stack = [];
411
+ var x = 0,
412
+ y = 0;
413
+ var stems = 0;
414
+
420
415
  function parse(code) {
421
416
  var i = 0;
422
417
 
@@ -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) {
@@ -825,19 +819,15 @@ var FontRendererFactory = function FontRendererFactoryClosure() {
825
819
  }
826
820
  }
827
821
 
828
- parse(code);
822
+ parse(charStringCode);
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
+ }
850
+
851
+ return fn;
852
+ }
862
853
 
863
- return fn;
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
- }
903
- }, {
904
- key: "compileGlyphImpl",
905
- value: function compileGlyphImpl() {
906
- (0, _util.unreachable)('Children classes should implement this.');
907
870
  }
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
+ }
918
890
 
919
- var TrueTypeCompiled =
920
- /*#__PURE__*/
921
- function (_CompiledFont) {
922
- _inherits(TrueTypeCompiled, _CompiledFont);
891
+ compileGlyphImpl() {
892
+ (0, _util.unreachable)("Children classes should implement this.");
893
+ }
923
894
 
924
- function TrueTypeCompiled(glyphs, cmap, fontMatrix) {
925
- var _this;
895
+ hasBuiltPath(unicode) {
896
+ const cmap = lookupCmap(this.cmap, unicode);
897
+ return this.compiledGlyphs[cmap.glyphId] !== undefined && this.compiledCharCodeToGlyphId[cmap.charCode] !== undefined;
898
+ }
926
899
 
927
- _classCallCheck(this, TrueTypeCompiled);
900
+ }
928
901
 
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;
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;
933
907
  }
934
908
 
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;
909
+ compileGlyphImpl(code, cmds) {
910
+ compileGlyf(code, cmds, this);
967
911
  }
968
912
 
969
- _createClass(Type2Compiled, [{
970
- key: "compileGlyphImpl",
971
- value: function compileGlyphImpl(code, cmds, glyphId) {
972
- compileCharString(code, cmds, this, glyphId);
973
- }
974
- }]);
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;
928
+ }
975
929
 
976
- return Type2Compiled;
977
- }(CompiledFont);
930
+ compileGlyphImpl(code, cmds, glyphId) {
931
+ compileCharString(code, cmds, this, glyphId);
932
+ }
933
+
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
  }