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.
- package/README.md +4 -0
- package/bower.json +1 -1
- package/build/pdf.js +8816 -19300
- package/build/pdf.js.map +1 -1
- package/build/pdf.min.js +22 -1
- package/build/pdf.worker.entry.js +5 -3
- package/build/pdf.worker.js +27185 -35746
- package/build/pdf.worker.js.map +1 -1
- package/build/pdf.worker.min.js +22 -1
- package/es5/build/pdf.js +26665 -0
- package/es5/build/pdf.js.map +1 -0
- package/es5/build/pdf.min.js +22 -0
- package/{lib/shared/global_scope.js → es5/build/pdf.worker.entry.js} +5 -10
- package/es5/build/pdf.worker.js +61231 -0
- package/es5/build/pdf.worker.js.map +1 -0
- package/es5/build/pdf.worker.min.js +22 -0
- package/es5/image_decoders/pdf.image_decoders.js +12529 -0
- package/es5/image_decoders/pdf.image_decoders.js.map +1 -0
- package/es5/image_decoders/pdf.image_decoders.min.js +22 -0
- package/es5/web/images/annotation-check.svg +11 -0
- package/es5/web/images/annotation-comment.svg +16 -0
- package/es5/web/images/annotation-help.svg +26 -0
- package/es5/web/images/annotation-insert.svg +10 -0
- package/es5/web/images/annotation-key.svg +11 -0
- package/es5/web/images/annotation-newparagraph.svg +11 -0
- package/es5/web/images/annotation-noicon.svg +7 -0
- package/es5/web/images/annotation-note.svg +42 -0
- package/es5/web/images/annotation-paragraph.svg +16 -0
- package/es5/web/images/loading-icon.gif +0 -0
- package/es5/web/images/shadow.png +0 -0
- package/es5/web/pdf_viewer.css +406 -0
- package/es5/web/pdf_viewer.js +7886 -0
- package/es5/web/pdf_viewer.js.map +1 -0
- package/image_decoders/pdf.image_decoders.js +1498 -4832
- package/image_decoders/pdf.image_decoders.js.map +1 -1
- package/image_decoders/pdf.image_decoders.min.js +22 -1
- package/lib/README.md +7 -0
- package/lib/core/annotation.js +1144 -927
- package/lib/core/arithmetic_decoder.js +81 -97
- package/lib/core/bidi.js +54 -46
- package/lib/core/ccitt.js +88 -81
- package/lib/core/ccitt_stream.js +15 -14
- package/lib/core/cff_parser.js +747 -716
- package/lib/core/charsets.js +4 -4
- package/lib/core/chunked_stream.js +462 -553
- package/lib/core/cmap.js +231 -277
- package/lib/core/colorspace.js +715 -857
- package/lib/core/core_utils.js +57 -52
- package/lib/core/crypto.js +416 -437
- package/lib/core/document.js +629 -670
- package/lib/core/encodings.js +15 -15
- package/lib/core/evaluator.js +3229 -2800
- package/lib/core/font_renderer.js +135 -178
- package/lib/core/fonts.js +602 -534
- package/lib/core/function.js +355 -279
- package/lib/core/glyphlist.js +4527 -4526
- package/lib/core/image.js +442 -439
- package/lib/core/image_utils.js +221 -61
- package/lib/core/jbig2.js +325 -316
- package/lib/core/jbig2_stream.js +18 -17
- package/lib/core/jpeg_stream.js +21 -26
- package/lib/core/jpg.js +289 -233
- package/lib/core/jpx.js +161 -143
- package/lib/core/jpx_stream.js +28 -28
- package/lib/core/metrics.js +2928 -2928
- package/lib/core/murmurhash3.js +87 -102
- package/lib/core/obj.js +1343 -1300
- package/lib/core/operator_list.js +90 -67
- package/lib/core/parser.js +990 -987
- package/lib/core/pattern.js +105 -77
- package/lib/core/pdf_manager.js +149 -316
- package/lib/core/primitives.js +156 -104
- package/lib/core/ps_parser.js +175 -214
- package/lib/core/standard_fonts.js +237 -236
- package/lib/core/stream.js +94 -74
- package/lib/core/type1_parser.js +89 -69
- package/lib/core/unicode.js +1654 -1654
- package/lib/core/worker.js +275 -290
- package/lib/core/worker_stream.js +101 -210
- package/lib/core/writer.js +242 -0
- package/lib/display/annotation_layer.js +772 -1041
- package/lib/display/annotation_storage.js +89 -0
- package/lib/display/api.js +1575 -1868
- package/lib/display/api_compatibility.js +12 -17
- package/lib/display/canvas.js +370 -222
- package/lib/display/content_disposition.js +40 -59
- package/lib/display/display_utils.js +341 -536
- package/lib/display/fetch_stream.js +188 -304
- package/lib/display/font_loader.js +282 -414
- package/lib/display/metadata.js +81 -99
- package/lib/display/network.js +362 -511
- package/lib/display/network_utils.js +25 -18
- package/lib/display/node_stream.js +283 -465
- package/lib/display/node_utils.js +87 -0
- package/lib/display/optional_content_config.js +184 -0
- package/lib/display/pattern_helper.js +93 -44
- package/lib/display/svg.js +1163 -1401
- package/lib/display/text_layer.js +154 -137
- package/lib/display/transport_stream.js +237 -375
- package/lib/display/webgl.js +70 -83
- package/lib/display/worker_options.js +3 -3
- package/lib/display/xml_parser.js +303 -392
- package/lib/examples/node/domstubs.js +37 -37
- package/lib/pdf.js +220 -58
- package/lib/pdf.worker.js +14 -6
- package/lib/shared/compatibility.js +3 -246
- package/lib/shared/is_node.js +7 -6
- package/lib/shared/message_handler.js +327 -332
- package/lib/shared/util.js +271 -306
- package/lib/test/unit/annotation_spec.js +1902 -763
- package/lib/test/unit/annotation_storage_spec.js +83 -0
- package/lib/test/unit/api_spec.js +790 -592
- package/lib/test/unit/bidi_spec.js +7 -7
- package/lib/test/unit/cff_parser_spec.js +73 -72
- package/lib/test/unit/clitests_helper.js +7 -9
- package/lib/test/unit/cmap_spec.js +86 -88
- package/lib/test/unit/colorspace_spec.js +346 -154
- package/lib/test/unit/core_utils_spec.js +125 -105
- package/lib/test/unit/crypto_spec.js +232 -185
- package/lib/test/unit/custom_spec.js +150 -24
- package/lib/test/unit/display_svg_spec.js +34 -39
- package/lib/test/unit/display_utils_spec.js +139 -149
- package/lib/test/unit/document_spec.js +128 -17
- package/lib/test/unit/encodings_spec.js +12 -34
- package/lib/test/unit/evaluator_spec.js +112 -91
- package/lib/test/unit/fetch_stream_spec.js +31 -29
- package/lib/test/unit/function_spec.js +206 -204
- package/lib/test/unit/jasmine-boot.js +48 -32
- package/lib/test/unit/message_handler_spec.js +173 -159
- package/lib/test/unit/metadata_spec.js +71 -71
- package/lib/test/unit/murmurhash3_spec.js +12 -12
- package/lib/test/unit/network_spec.js +13 -11
- package/lib/test/unit/network_utils_spec.js +158 -144
- package/lib/test/unit/node_stream_spec.js +76 -90
- package/lib/test/unit/parser_spec.js +108 -114
- package/lib/test/unit/pdf_find_controller_spec.js +55 -86
- package/lib/test/unit/pdf_find_utils_spec.js +32 -32
- package/lib/test/unit/pdf_history_spec.js +32 -32
- package/lib/test/unit/primitives_spec.js +337 -156
- package/lib/test/unit/stream_spec.js +16 -14
- package/lib/test/unit/test_utils.js +91 -304
- package/lib/test/unit/testreporter.js +33 -22
- package/lib/test/unit/type1_parser_spec.js +42 -42
- package/lib/test/unit/ui_utils_spec.js +299 -461
- package/lib/test/unit/unicode_spec.js +42 -42
- package/lib/test/unit/util_spec.js +129 -149
- package/lib/test/unit/writer_spec.js +84 -0
- package/lib/web/annotation_layer_builder.js +78 -111
- package/lib/web/app.js +1542 -1267
- package/lib/web/app_options.js +76 -91
- package/lib/web/base_tree_viewer.js +100 -0
- package/lib/web/base_viewer.js +869 -834
- package/lib/web/chromecom.js +165 -252
- package/lib/web/debugger.js +149 -205
- package/lib/web/download_manager.js +34 -58
- package/lib/web/firefox_print_service.js +62 -34
- package/lib/web/firefoxcom.js +206 -374
- package/lib/web/genericcom.js +26 -108
- package/lib/web/genericl10n.js +24 -153
- package/lib/web/grab_to_pan.js +30 -30
- package/lib/web/interfaces.js +80 -254
- package/lib/web/overlay_manager.js +70 -246
- package/lib/web/password_prompt.js +38 -64
- package/lib/web/pdf_attachment_viewer.js +150 -126
- package/lib/web/pdf_cursor_tools.js +75 -102
- package/lib/web/pdf_document_properties.js +229 -383
- package/lib/web/pdf_find_bar.js +136 -170
- package/lib/web/pdf_find_controller.js +492 -548
- package/lib/web/pdf_find_utils.js +13 -13
- package/lib/web/pdf_history.js +397 -406
- package/lib/web/pdf_layer_viewer.js +208 -0
- package/lib/web/pdf_link_service.js +304 -348
- package/lib/web/pdf_outline_viewer.js +119 -212
- package/lib/web/pdf_page_view.js +474 -513
- package/lib/web/pdf_presentation_mode.js +308 -357
- package/lib/web/pdf_print_service.js +96 -110
- package/lib/web/pdf_rendering_queue.js +87 -108
- package/lib/web/pdf_sidebar.js +286 -302
- package/lib/web/pdf_sidebar_resizer.js +92 -119
- package/lib/web/pdf_single_page_viewer.js +77 -126
- package/lib/web/pdf_thumbnail_view.js +289 -297
- package/lib/web/pdf_thumbnail_viewer.js +202 -206
- package/lib/web/pdf_viewer.component.js +20 -21
- package/lib/web/pdf_viewer.js +55 -115
- package/lib/web/preferences.js +69 -273
- package/lib/web/secondary_toolbar.js +164 -196
- package/lib/web/text_layer_builder.js +284 -319
- package/lib/web/toolbar.js +217 -210
- package/lib/web/ui_utils.js +274 -421
- package/lib/web/view_history.js +52 -226
- package/lib/web/viewer_compatibility.js +21 -6
- package/package.json +4 -9
- package/types/display/annotation_layer.d.ts +61 -0
- package/types/display/annotation_storage.d.ts +36 -0
- package/types/display/api.d.ts +1107 -0
- package/types/display/api_compatibility.d.ts +1 -0
- package/types/display/canvas.d.ts +4 -0
- package/types/display/content_disposition.d.ts +7 -0
- package/types/display/display_utils.d.ts +243 -0
- package/types/display/fetch_stream.d.ts +67 -0
- package/types/display/font_loader.d.ts +19 -0
- package/types/display/metadata.d.ts +9 -0
- package/types/display/network.d.ts +80 -0
- package/types/display/network_utils.d.ts +14 -0
- package/types/display/node_stream.d.ts +72 -0
- package/types/display/node_utils.d.ts +6 -0
- package/types/display/optional_content_config.d.ts +12 -0
- package/types/display/pattern_helper.d.ts +5 -0
- package/types/display/svg.d.ts +2 -0
- package/types/display/text_layer.d.ts +83 -0
- package/types/display/transport_stream.d.ts +57 -0
- package/types/display/webgl.d.ts +20 -0
- package/types/display/worker_options.d.ts +27 -0
- package/types/display/xml_parser.d.ts +35 -0
- package/types/pdf.d.ts +33 -0
- package/types/shared/compatibility.d.ts +1 -0
- package/types/shared/is_node.d.ts +1 -0
- package/types/shared/message_handler.d.ts +62 -0
- package/types/shared/util.d.ts +421 -0
- package/web/images/shadow.png +0 -0
- package/web/pdf_viewer.css +29 -27
- package/web/pdf_viewer.js +3524 -4746
- package/web/pdf_viewer.js.map +1 -1
- package/webpack.js +6 -5
- package/external/streams/streams-lib.js +0 -3962
- package/external/url/url-lib.js +0 -627
- package/lib/shared/streams_polyfill.js +0 -43
- package/lib/shared/url_polyfill.js +0 -56
- package/web/images/texture.png +0 -0
package/lib/core/type1_parser.js
CHANGED
@@ -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
|
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
|
29
|
+
var _encodings = require("./encodings.js");
|
30
30
|
|
31
|
-
var
|
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
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
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
|
-
|
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 &
|
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
|
411
|
+
return decrypted.slice(discardNumber, j);
|
406
412
|
}
|
407
413
|
|
408
414
|
function isSpecial(c) {
|
409
|
-
return c ===
|
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 ===
|
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 ===
|
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 ===
|
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,
|
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,
|
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
|
510
|
+
privateData.lenIV = 4;
|
505
511
|
var program = {
|
506
512
|
subrs: [],
|
507
513
|
charstrings: [],
|
508
514
|
properties: {
|
509
|
-
|
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
|
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 ===
|
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
|
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 ===
|
554
|
+
if (token === "noaccess") {
|
549
555
|
this.getToken();
|
550
556
|
}
|
551
557
|
|
552
558
|
charstrings.push({
|
553
|
-
glyph
|
554
|
-
encoded
|
559
|
+
glyph,
|
560
|
+
encoded
|
555
561
|
});
|
556
562
|
}
|
557
563
|
|
558
564
|
break;
|
559
565
|
|
560
|
-
case
|
566
|
+
case "Subrs":
|
561
567
|
this.readInt();
|
562
568
|
this.getToken();
|
563
569
|
|
564
|
-
while (this.getToken() ===
|
565
|
-
|
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
|
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 ===
|
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
|
584
|
-
case
|
585
|
-
case
|
586
|
-
case
|
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
|
596
|
-
case
|
601
|
+
case "StemSnapH":
|
602
|
+
case "StemSnapV":
|
597
603
|
program.properties.privateData[token] = this.readNumberArray();
|
598
604
|
break;
|
599
605
|
|
600
|
-
case
|
601
|
-
case
|
606
|
+
case "StdHW":
|
607
|
+
case "StdVW":
|
602
608
|
program.properties.privateData[token] = this.readNumberArray()[0];
|
603
609
|
break;
|
604
610
|
|
605
|
-
case
|
606
|
-
case
|
607
|
-
case
|
608
|
-
case
|
609
|
-
case
|
610
|
-
case
|
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
|
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
|
-
|
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
|
673
|
+
case "FontMatrix":
|
654
674
|
var matrix = this.readNumberArray();
|
655
675
|
properties.fontMatrix = matrix;
|
656
676
|
break;
|
657
677
|
|
658
|
-
case
|
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 !==
|
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 ===
|
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
|
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]);
|