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.
@@ -21,21 +21,21 @@
21
21
  */
22
22
  "use strict";
23
23
 
24
- var _bidi = require("../../core/bidi");
24
+ var _bidi = require("../../core/bidi.js");
25
25
 
26
- describe('bidi', function () {
27
- it('should mark text as RTL if more than 30% of text is RTL', function () {
26
+ describe("bidi", function () {
27
+ it("should mark text as RTL if more than 30% of text is RTL", function () {
28
28
  var test = "\u0645\u0635\u0631 Egypt";
29
29
  var result = "Egypt \u0631\u0635\u0645";
30
30
  var bidiText = (0, _bidi.bidi)(test, -1, false);
31
31
  expect(bidiText.str).toEqual(result);
32
- expect(bidiText.dir).toEqual('rtl');
32
+ expect(bidiText.dir).toEqual("rtl");
33
33
  });
34
- it('should mark text as LTR if less than 30% of text is RTL', function () {
34
+ it("should mark text as LTR if less than 30% of text is RTL", function () {
35
35
  var test = "Egypt is known as \u0645\u0635\u0631 in Arabic.";
36
36
  var result = "Egypt is known as \u0631\u0635\u0645 in Arabic.";
37
37
  var bidiText = (0, _bidi.bidi)(test, -1, false);
38
38
  expect(bidiText.str).toEqual(result);
39
- expect(bidiText.dir).toEqual('ltr');
39
+ expect(bidiText.dir).toEqual("ltr");
40
40
  });
41
41
  });
@@ -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.
@@ -21,13 +21,13 @@
21
21
  */
22
22
  "use strict";
23
23
 
24
- var _cff_parser = require("../../core/cff_parser");
24
+ var _cff_parser = require("../../core/cff_parser.js");
25
25
 
26
- var _fonts = require("../../core/fonts");
26
+ var _fonts = require("../../core/fonts.js");
27
27
 
28
- var _stream = require("../../core/stream");
28
+ var _stream = require("../../core/stream.js");
29
29
 
30
- describe('CFFParser', function () {
30
+ describe("CFFParser", function () {
31
31
  function createWithNullProto(obj) {
32
32
  var result = Object.create(null);
33
33
 
@@ -39,13 +39,14 @@ describe('CFFParser', function () {
39
39
  }
40
40
 
41
41
  var privateDictStub = {
42
- getByName: function getByName(name) {
42
+ getByName(name) {
43
43
  return 0;
44
44
  }
45
+
45
46
  };
46
47
  var fontData, parser, cff;
47
48
  beforeAll(function (done) {
48
- var exampleFont = '0100040100010101134142434445462b' + '54696d65732d526f6d616e000101011f' + 'f81b00f81c02f81d03f819041c6f000d' + 'fb3cfb6efa7cfa1605e911b8f1120003' + '01010813183030312e30303754696d65' + '7320526f6d616e54696d657300000002' + '010102030e0e7d99f92a99fb7695f773' + '8b06f79a93fc7c8c077d99f85695f75e' + '9908fb6e8cf87393f7108b09a70adf0b' + 'f78e14';
49
+ var exampleFont = "0100040100010101134142434445462b" + "54696d65732d526f6d616e000101011f" + "f81b00f81c02f81d03f819041c6f000d" + "fb3cfb6efa7cfa1605e911b8f1120003" + "01010813183030312e30303754696d65" + "7320526f6d616e54696d657300000002" + "010102030e0e7d99f92a99fb7695f773" + "8b06f79a93fc7c8c077d99f85695f75e" + "9908fb6e8cf87393f7108b09a70adf0b" + "f78e14";
49
50
  var fontArr = [];
50
51
 
51
52
  for (var i = 0, ii = exampleFont.length; i < ii; i += 2) {
@@ -68,56 +69,56 @@ describe('CFFParser', function () {
68
69
  parser = cff = null;
69
70
  done();
70
71
  });
71
- it('parses header', function () {
72
+ it("parses header", function () {
72
73
  var header = cff.header;
73
74
  expect(header.major).toEqual(1);
74
75
  expect(header.minor).toEqual(0);
75
76
  expect(header.hdrSize).toEqual(4);
76
77
  expect(header.offSize).toEqual(1);
77
78
  });
78
- it('parses name index', function () {
79
+ it("parses name index", function () {
79
80
  var names = cff.names;
80
81
  expect(names.length).toEqual(1);
81
- expect(names[0]).toEqual('ABCDEF+Times-Roman');
82
+ expect(names[0]).toEqual("ABCDEF+Times-Roman");
82
83
  });
83
- it('parses string index', function () {
84
+ it("parses string index", function () {
84
85
  var strings = cff.strings;
85
86
  expect(strings.count).toEqual(3);
86
- expect(strings.get(0)).toEqual('.notdef');
87
- expect(strings.get(391)).toEqual('001.007');
87
+ expect(strings.get(0)).toEqual(".notdef");
88
+ expect(strings.get(391)).toEqual("001.007");
88
89
  });
89
- it('parses top dict', function () {
90
+ it("parses top dict", function () {
90
91
  var topDict = cff.topDict;
91
- expect(topDict.getByName('version')).toEqual(391);
92
- expect(topDict.getByName('FullName')).toEqual(392);
93
- expect(topDict.getByName('FamilyName')).toEqual(393);
94
- expect(topDict.getByName('Weight')).toEqual(389);
95
- expect(topDict.getByName('UniqueID')).toEqual(28416);
96
- expect(topDict.getByName('FontBBox')).toEqual([-168, -218, 1000, 898]);
97
- expect(topDict.getByName('CharStrings')).toEqual(94);
98
- expect(topDict.getByName('Private')).toEqual([45, 102]);
92
+ expect(topDict.getByName("version")).toEqual(391);
93
+ expect(topDict.getByName("FullName")).toEqual(392);
94
+ expect(topDict.getByName("FamilyName")).toEqual(393);
95
+ expect(topDict.getByName("Weight")).toEqual(389);
96
+ expect(topDict.getByName("UniqueID")).toEqual(28416);
97
+ expect(topDict.getByName("FontBBox")).toEqual([-168, -218, 1000, 898]);
98
+ expect(topDict.getByName("CharStrings")).toEqual(94);
99
+ expect(topDict.getByName("Private")).toEqual([45, 102]);
99
100
  });
100
- it('refuses to add topDict key with invalid value (bug 1068432)', function () {
101
+ it("refuses to add topDict key with invalid value (bug 1068432)", function () {
101
102
  var topDict = cff.topDict;
102
- var defaultValue = topDict.getByName('UnderlinePosition');
103
+ var defaultValue = topDict.getByName("UnderlinePosition");
103
104
  topDict.setByKey(3075, [NaN]);
104
- expect(topDict.getByName('UnderlinePosition')).toEqual(defaultValue);
105
+ expect(topDict.getByName("UnderlinePosition")).toEqual(defaultValue);
105
106
  });
106
- it('ignores reserved commands in parseDict, and refuses to add privateDict ' + 'keys with invalid values (bug 1308536)', function () {
107
+ it("ignores reserved commands in parseDict, and refuses to add privateDict " + "keys with invalid values (bug 1308536)", function () {
107
108
  var bytes = new Uint8Array([64, 39, 31, 30, 252, 114, 137, 115, 79, 30, 197, 119, 2, 99, 127, 6]);
108
109
  parser.bytes = bytes;
109
110
  var topDict = cff.topDict;
110
- topDict.setByName('Private', [bytes.length, 0]);
111
+ topDict.setByName("Private", [bytes.length, 0]);
111
112
 
112
- var parsePrivateDict = function parsePrivateDict() {
113
+ var parsePrivateDict = function () {
113
114
  parser.parsePrivateDict(topDict);
114
115
  };
115
116
 
116
117
  expect(parsePrivateDict).not.toThrow();
117
118
  var privateDict = topDict.privateDict;
118
- expect(privateDict.getByName('BlueValues')).toBeNull();
119
+ expect(privateDict.getByName("BlueValues")).toBeNull();
119
120
  });
120
- it('parses a CharString having cntrmask', function () {
121
+ it("parses a CharString having cntrmask", function () {
121
122
  var bytes = new Uint8Array([0, 1, 1, 0, 38, 149, 149, 149, 149, 149, 149, 149, 149, 149, 149, 149, 149, 149, 149, 149, 149, 1, 149, 149, 149, 149, 149, 149, 149, 149, 149, 149, 149, 149, 149, 149, 149, 149, 3, 20, 22, 22, 14]);
122
123
  parser.bytes = bytes;
123
124
  var charStringsIndex = parser.parseIndex(0).obj;
@@ -128,7 +129,7 @@ describe('CFFParser', function () {
128
129
  expect(charStrings.count).toEqual(1);
129
130
  expect(charStrings.get(0).length).toEqual(38);
130
131
  });
131
- it('parses a CharString endchar with 4 args w/seac enabled', function () {
132
+ it("parses a CharString endchar with 4 args w/seac enabled", function () {
132
133
  var parser = new _cff_parser.CFFParser(fontData, {}, true);
133
134
  parser.parse();
134
135
  var bytes = new Uint8Array([0, 1, 1, 0, 237, 247, 22, 247, 72, 204, 247, 86, 14]);
@@ -147,7 +148,7 @@ describe('CFFParser', function () {
147
148
  expect(result.seacs[0][2]).toEqual(65);
148
149
  expect(result.seacs[0][3]).toEqual(194);
149
150
  });
150
- it('parses a CharString endchar with 4 args w/seac disabled', function () {
151
+ it("parses a CharString endchar with 4 args w/seac disabled", function () {
151
152
  var parser = new _cff_parser.CFFParser(fontData, {}, false);
152
153
  parser.parse();
153
154
  var bytes = new Uint8Array([0, 1, 1, 0, 237, 247, 22, 247, 72, 204, 247, 86, 14]);
@@ -161,7 +162,7 @@ describe('CFFParser', function () {
161
162
  expect(result.charStrings.get(0).length).toEqual(9);
162
163
  expect(result.seacs.length).toEqual(0);
163
164
  });
164
- it('parses a CharString endchar no args', function () {
165
+ it("parses a CharString endchar no args", function () {
165
166
  var bytes = new Uint8Array([0, 1, 1, 0, 14]);
166
167
  parser.bytes = bytes;
167
168
  var charStringsIndex = parser.parseIndex(0).obj;
@@ -173,35 +174,35 @@ describe('CFFParser', function () {
173
174
  expect(result.charStrings.get(0)[0]).toEqual(14);
174
175
  expect(result.seacs.length).toEqual(0);
175
176
  });
176
- it('parses predefined charsets', function () {
177
+ it("parses predefined charsets", function () {
177
178
  var charset = parser.parseCharsets(0, 0, null, true);
178
179
  expect(charset.predefined).toEqual(true);
179
180
  });
180
- it('parses charset format 0', function () {
181
+ it("parses charset format 0", function () {
181
182
  var bytes = new Uint8Array([0x00, 0x00, 0x00, 0x00, 0x00, 0x02]);
182
183
  parser.bytes = bytes;
183
184
  var charset = parser.parseCharsets(3, 2, new _cff_parser.CFFStrings(), false);
184
- expect(charset.charset[1]).toEqual('exclam');
185
+ expect(charset.charset[1]).toEqual("exclam");
185
186
  charset = parser.parseCharsets(3, 2, new _cff_parser.CFFStrings(), true);
186
187
  expect(charset.charset[1]).toEqual(2);
187
188
  });
188
- it('parses charset format 1', function () {
189
+ it("parses charset format 1", function () {
189
190
  var bytes = new Uint8Array([0x00, 0x00, 0x00, 0x01, 0x00, 0x08, 0x01]);
190
191
  parser.bytes = bytes;
191
192
  var charset = parser.parseCharsets(3, 2, new _cff_parser.CFFStrings(), false);
192
- expect(charset.charset).toEqual(['.notdef', 'quoteright', 'parenleft']);
193
+ expect(charset.charset).toEqual([".notdef", "quoteright", "parenleft"]);
193
194
  charset = parser.parseCharsets(3, 2, new _cff_parser.CFFStrings(), true);
194
- expect(charset.charset).toEqual(['.notdef', 8, 9]);
195
+ expect(charset.charset).toEqual([".notdef", 8, 9]);
195
196
  });
196
- it('parses charset format 2', function () {
197
+ it("parses charset format 2", function () {
197
198
  var bytes = new Uint8Array([0x00, 0x00, 0x00, 0x02, 0x00, 0x08, 0x00, 0x01]);
198
199
  parser.bytes = bytes;
199
200
  var charset = parser.parseCharsets(3, 2, new _cff_parser.CFFStrings(), false);
200
- expect(charset.charset).toEqual(['.notdef', 'quoteright', 'parenleft']);
201
+ expect(charset.charset).toEqual([".notdef", "quoteright", "parenleft"]);
201
202
  charset = parser.parseCharsets(3, 2, new _cff_parser.CFFStrings(), true);
202
- expect(charset.charset).toEqual(['.notdef', 8, 9]);
203
+ expect(charset.charset).toEqual([".notdef", 8, 9]);
203
204
  });
204
- it('parses encoding format 0', function () {
205
+ it("parses encoding format 0", function () {
205
206
  var bytes = new Uint8Array([0x00, 0x00, 0x00, 0x01, 0x08]);
206
207
  parser.bytes = bytes;
207
208
  var encoding = parser.parseEncoding(2, {}, new _cff_parser.CFFStrings(), null);
@@ -209,7 +210,7 @@ describe('CFFParser', function () {
209
210
  0x8: 1
210
211
  }));
211
212
  });
212
- it('parses encoding format 1', function () {
213
+ it("parses encoding format 1", function () {
213
214
  var bytes = new Uint8Array([0x00, 0x00, 0x01, 0x01, 0x07, 0x01]);
214
215
  parser.bytes = bytes;
215
216
  var encoding = parser.parseEncoding(2, {}, new _cff_parser.CFFStrings(), null);
@@ -218,21 +219,21 @@ describe('CFFParser', function () {
218
219
  0x08: 0x02
219
220
  }));
220
221
  });
221
- it('parses fdselect format 0', function () {
222
+ it("parses fdselect format 0", function () {
222
223
  var bytes = new Uint8Array([0x00, 0x00, 0x01]);
223
224
  parser.bytes = bytes.slice();
224
225
  var fdSelect = parser.parseFDSelect(0, 2);
225
226
  expect(fdSelect.fdSelect).toEqual([0, 1]);
226
227
  expect(fdSelect.format).toEqual(0);
227
228
  });
228
- it('parses fdselect format 3', function () {
229
+ it("parses fdselect format 3", function () {
229
230
  var bytes = new Uint8Array([0x03, 0x00, 0x02, 0x00, 0x00, 0x09, 0x00, 0x02, 0x0a, 0x00, 0x04]);
230
231
  parser.bytes = bytes.slice();
231
232
  var fdSelect = parser.parseFDSelect(0, 4);
232
233
  expect(fdSelect.fdSelect).toEqual([9, 9, 0xa, 0xa]);
233
234
  expect(fdSelect.format).toEqual(3);
234
235
  });
235
- it('parses invalid fdselect format 3 (bug 1146106)', function () {
236
+ it("parses invalid fdselect format 3 (bug 1146106)", function () {
236
237
  var bytes = new Uint8Array([0x03, 0x00, 0x02, 0x00, 0x01, 0x09, 0x00, 0x02, 0x0a, 0x00, 0x04]);
237
238
  parser.bytes = bytes.slice();
238
239
  var fdSelect = parser.parseFDSelect(0, 4);
@@ -240,17 +241,17 @@ describe('CFFParser', function () {
240
241
  expect(fdSelect.format).toEqual(3);
241
242
  });
242
243
  });
243
- describe('CFFCompiler', function () {
244
+ describe("CFFCompiler", function () {
244
245
  function testParser(bytes) {
245
246
  bytes = new Uint8Array(bytes);
246
247
  return new _cff_parser.CFFParser({
247
- getBytes: function getBytes() {
248
+ getBytes: () => {
248
249
  return bytes;
249
250
  }
250
251
  }, {}, _fonts.SEAC_ANALYSIS_ENABLED);
251
252
  }
252
253
 
253
- it('encodes integers', function () {
254
+ it("encodes integers", function () {
254
255
  var c = new _cff_parser.CFFCompiler();
255
256
  expect(c.encodeInteger(0)).toEqual([0x8b]);
256
257
  expect(c.encodeInteger(100)).toEqual([0xef]);
@@ -262,22 +263,22 @@ describe('CFFCompiler', function () {
262
263
  expect(c.encodeInteger(100000)).toEqual([0x1d, 0x00, 0x01, 0x86, 0xa0]);
263
264
  expect(c.encodeInteger(-100000)).toEqual([0x1d, 0xff, 0xfe, 0x79, 0x60]);
264
265
  });
265
- it('encodes floats', function () {
266
+ it("encodes floats", function () {
266
267
  var c = new _cff_parser.CFFCompiler();
267
268
  expect(c.encodeFloat(-2.25)).toEqual([0x1e, 0xe2, 0xa2, 0x5f]);
268
269
  expect(c.encodeFloat(5e-11)).toEqual([0x1e, 0x5c, 0x11, 0xff]);
269
270
  });
270
- it('sanitizes name index', function () {
271
+ it("sanitizes name index", function () {
271
272
  var c = new _cff_parser.CFFCompiler();
272
- var nameIndexCompiled = c.compileNameIndex(['[a']);
273
+ var nameIndexCompiled = c.compileNameIndex(["[a"]);
273
274
  var parser = testParser(nameIndexCompiled);
274
275
  var nameIndex = parser.parseIndex(0);
275
276
  var names = parser.parseNameIndex(nameIndex.obj);
276
- expect(names).toEqual(['_a']);
277
- var longName = '';
277
+ expect(names).toEqual(["_a"]);
278
+ var longName = "";
278
279
 
279
280
  for (var i = 0; i < 129; i++) {
280
- longName += '_';
281
+ longName += "_";
281
282
  }
282
283
 
283
284
  nameIndexCompiled = c.compileNameIndex([longName]);
@@ -286,33 +287,33 @@ describe('CFFCompiler', function () {
286
287
  names = parser.parseNameIndex(nameIndex.obj);
287
288
  expect(names[0].length).toEqual(127);
288
289
  });
289
- it('compiles fdselect format 0', function () {
290
+ it("compiles fdselect format 0", function () {
290
291
  var fdSelect = new _cff_parser.CFFFDSelect(0, [3, 2, 1]);
291
292
  var c = new _cff_parser.CFFCompiler();
292
293
  var out = c.compileFDSelect(fdSelect);
293
294
  expect(out).toEqual([0, 3, 2, 1]);
294
295
  });
295
- it('compiles fdselect format 3', function () {
296
+ it("compiles fdselect format 3", function () {
296
297
  var fdSelect = new _cff_parser.CFFFDSelect(3, [0, 0, 1, 1]);
297
298
  var c = new _cff_parser.CFFCompiler();
298
299
  var out = c.compileFDSelect(fdSelect);
299
300
  expect(out).toEqual([3, 0, 2, 0, 0, 0, 0, 2, 1, 0, 4]);
300
301
  });
301
- it('compiles fdselect format 3, single range', function () {
302
+ it("compiles fdselect format 3, single range", function () {
302
303
  var fdSelect = new _cff_parser.CFFFDSelect(3, [0, 0]);
303
304
  var c = new _cff_parser.CFFCompiler();
304
305
  var out = c.compileFDSelect(fdSelect);
305
306
  expect(out).toEqual([3, 0, 1, 0, 0, 0, 0, 2]);
306
307
  });
307
- it('compiles charset of CID font', function () {
308
+ it("compiles charset of CID font", function () {
308
309
  var charset = new _cff_parser.CFFCharset();
309
310
  var c = new _cff_parser.CFFCompiler();
310
311
  var numGlyphs = 7;
311
312
  var out = c.compileCharset(charset, numGlyphs, new _cff_parser.CFFStrings(), true);
312
313
  expect(out).toEqual([2, 0, 0, 0, numGlyphs - 1]);
313
314
  });
314
- it('compiles charset of non CID font', function () {
315
- var charset = new _cff_parser.CFFCharset(false, 0, ['space', 'exclam']);
315
+ it("compiles charset of non CID font", function () {
316
+ var charset = new _cff_parser.CFFCharset(false, 0, ["space", "exclam"]);
316
317
  var c = new _cff_parser.CFFCompiler();
317
318
  var numGlyphs = 3;
318
319
  var out = c.compileCharset(charset, numGlyphs, new _cff_parser.CFFStrings(), false);
@@ -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.
@@ -21,18 +21,16 @@
21
21
  */
22
22
  "use strict";
23
23
 
24
- var _util = require("../../shared/util");
24
+ var _util = require("../../shared/util.js");
25
25
 
26
- var _is_node = _interopRequireDefault(require("../../shared/is_node"));
26
+ var _is_node = require("../../shared/is_node.js");
27
27
 
28
- var _node_stream = require("../../display/node_stream");
28
+ var _node_stream = require("../../display/node_stream.js");
29
29
 
30
- var _api = require("../../display/api");
30
+ var _api = require("../../display/api.js");
31
31
 
32
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
33
-
34
- if (!(0, _is_node["default"])()) {
35
- throw new Error('The `gulp unittestcli` command can only be used in ' + 'Node.js environments.');
32
+ if (!_is_node.isNodeJS) {
33
+ throw new Error("The `gulp unittestcli` command can only be used in " + "Node.js environments.");
36
34
  }
37
35
 
38
36
  (0, _util.setVerbosityLevel)(_util.VerbosityLevel.ERRORS);