Add // prettier-ignore
comments to prevent re-formatting of certain data structures
There's a fair number of (primarily) `Array`s/`TypedArray`s whose formatting we don't want disturb, since in many cases that would lead to the code becoming much more difficult to read and/or break existing inline comments. *Please note:* It may be a good idea to look through these cases individually, and possibly re-write some of the them (especially the `String` ones) to reduce the need for all of these ignore commands.
This commit is contained in:
parent
c3a1c67950
commit
8ec1dfde49
@ -17,6 +17,7 @@ import { warn } from '../shared/util';
|
||||
|
||||
// Character types for symbols from 0000 to 00FF.
|
||||
// Source: ftp://ftp.unicode.org/Public/UNIDATA/UnicodeData.txt
|
||||
// prettier-ignore
|
||||
var baseTypes = [
|
||||
'BN', 'BN', 'BN', 'BN', 'BN', 'BN', 'BN', 'BN', 'BN', 'S', 'B', 'S',
|
||||
'WS', 'B', 'BN', 'BN', 'BN', 'BN', 'BN', 'BN', 'BN', 'BN', 'BN', 'BN',
|
||||
@ -46,6 +47,7 @@ var baseTypes = [
|
||||
// http://unicode.org/charts/PDF/U0600.pdf), so we replace it with an
|
||||
// empty string and issue a warning if we encounter this character. The
|
||||
// empty string is required to properly index the items after it.
|
||||
// prettier-ignore
|
||||
var arabicTypes = [
|
||||
'AN', 'AN', 'AN', 'AN', 'AN', 'AN', 'ON', 'ON', 'AL', 'ET', 'ET', 'AL',
|
||||
'CS', 'AL', 'ON', 'ON', 'NSM', 'NSM', 'NSM', 'NSM', 'NSM', 'NSM', 'NSM',
|
||||
|
@ -41,6 +41,7 @@ let CCITTFaxDecoder = (function CCITTFaxDecoder() {
|
||||
const twoDimVertR3 = 7;
|
||||
const twoDimVertL3 = 8;
|
||||
|
||||
// prettier-ignore
|
||||
const twoDimTable = [
|
||||
[-1, -1], [-1, -1], // 000000x
|
||||
[7, twoDimVertL3], // 0000010
|
||||
@ -109,6 +110,7 @@ let CCITTFaxDecoder = (function CCITTFaxDecoder() {
|
||||
[1, twoDimVert0], [1, twoDimVert0]
|
||||
];
|
||||
|
||||
// prettier-ignore
|
||||
const whiteTable1 = [
|
||||
[-1, -1], // 00000
|
||||
[12, ccittEOL], // 00001
|
||||
@ -131,6 +133,7 @@ let CCITTFaxDecoder = (function CCITTFaxDecoder() {
|
||||
[12, 2560] // 11111
|
||||
];
|
||||
|
||||
// prettier-ignore
|
||||
const whiteTable2 = [
|
||||
[-1, -1], [-1, -1], [-1, -1], [-1, -1], // 0000000xx
|
||||
[8, 29], [8, 29], // 00000010x
|
||||
@ -295,6 +298,7 @@ let CCITTFaxDecoder = (function CCITTFaxDecoder() {
|
||||
[4, 7], [4, 7], [4, 7], [4, 7]
|
||||
];
|
||||
|
||||
// prettier-ignore
|
||||
const blackTable1 = [
|
||||
[-1, -1], [-1, -1], // 000000000000x
|
||||
[12, ccittEOL], [12, ccittEOL], // 000000000001x
|
||||
@ -356,6 +360,7 @@ let CCITTFaxDecoder = (function CCITTFaxDecoder() {
|
||||
[10, 64], [10, 64], [10, 64], [10, 64]
|
||||
];
|
||||
|
||||
// prettier-ignore
|
||||
const blackTable2 = [
|
||||
[8, 13], [8, 13], [8, 13], [8, 13], // 00000100xxxx
|
||||
[8, 13], [8, 13], [8, 13], [8, 13],
|
||||
@ -435,6 +440,7 @@ let CCITTFaxDecoder = (function CCITTFaxDecoder() {
|
||||
[7, 12], [7, 12], [7, 12], [7, 12]
|
||||
];
|
||||
|
||||
// prettier-ignore
|
||||
const blackTable3 = [
|
||||
[-1, -1], [-1, -1], [-1, -1], [-1, -1], // 0000xx
|
||||
[6, 9], // 000100
|
||||
|
@ -28,6 +28,7 @@ var MAX_SUBR_NESTING = 10;
|
||||
* The CFF class takes a Type1 file and wrap it into a
|
||||
* 'Compact Font Format' which itself embed Type2 charstrings.
|
||||
*/
|
||||
// prettier-ignore
|
||||
var CFFStandardStrings = [
|
||||
'.notdef', 'space', 'exclam', 'quotedbl', 'numbersign', 'dollar', 'percent',
|
||||
'ampersand', 'quoteright', 'parenleft', 'parenright', 'asterisk', 'plus',
|
||||
@ -339,7 +340,8 @@ var CFFParser = (function CFFParserClosure() {
|
||||
function parseFloatOperand() {
|
||||
var str = '';
|
||||
var eof = 15;
|
||||
var lookup = ['0', '1', '2', '3', '4', '5', '6', '7', '8',
|
||||
// prettier-ignore
|
||||
const lookup = ['0', '1', '2', '3', '4', '5', '6', '7', '8',
|
||||
'9', '.', 'E', 'E-', null, '-'];
|
||||
var length = dict.length;
|
||||
while (pos < length) {
|
||||
@ -1087,6 +1089,7 @@ var CFFTopDict = (function CFFTopDictClosure() {
|
||||
[[12, 4], 'UnderlineThickness', 'num', 50],
|
||||
[[12, 5], 'PaintType', 'num', 0],
|
||||
[[12, 6], 'CharstringType', 'num', 2],
|
||||
// prettier-ignore
|
||||
[[12, 7], 'FontMatrix', ['num', 'num', 'num', 'num', 'num', 'num'],
|
||||
[0.001, 0, 0, 0.001, 0, 0]],
|
||||
[13, 'UniqueID', 'num', null],
|
||||
|
@ -14,6 +14,7 @@
|
||||
*/
|
||||
/* eslint no-var: error */
|
||||
|
||||
// prettier-ignore
|
||||
const ISOAdobeCharset = [
|
||||
'.notdef', 'space', 'exclam', 'quotedbl', 'numbersign', 'dollar',
|
||||
'percent', 'ampersand', 'quoteright', 'parenleft', 'parenright',
|
||||
@ -51,6 +52,7 @@ const ISOAdobeCharset = [
|
||||
'ugrave', 'yacute', 'ydieresis', 'zcaron'
|
||||
];
|
||||
|
||||
// prettier-ignore
|
||||
const ExpertCharset = [
|
||||
'.notdef', 'space', 'exclamsmall', 'Hungarumlautsmall', 'dollaroldstyle',
|
||||
'dollarsuperior', 'ampersandsmall', 'Acutesmall', 'parenleftsuperior',
|
||||
@ -91,6 +93,7 @@ const ExpertCharset = [
|
||||
'Ydieresissmall'
|
||||
];
|
||||
|
||||
// prettier-ignore
|
||||
const ExpertSubsetCharset = [
|
||||
'.notdef', 'space', 'dollaroldstyle', 'dollarsuperior',
|
||||
'parenleftsuperior', 'parenrightsuperior', 'twodotenleader',
|
||||
|
@ -863,17 +863,20 @@ const CalGrayCS = (function CalGrayCSClosure() {
|
||||
const CalRGBCS = (function CalRGBCSClosure() {
|
||||
// See http://www.brucelindbloom.com/index.html?Eqn_ChromAdapt.html for these
|
||||
// matrices.
|
||||
// prettier-ignore
|
||||
const BRADFORD_SCALE_MATRIX = new Float32Array([
|
||||
0.8951, 0.2664, -0.1614,
|
||||
-0.7502, 1.7135, 0.0367,
|
||||
0.0389, -0.0685, 1.0296]);
|
||||
|
||||
// prettier-ignore
|
||||
const BRADFORD_SCALE_INVERSE_MATRIX = new Float32Array([
|
||||
0.9869929, -0.1470543, 0.1599627,
|
||||
0.4323053, 0.5183603, 0.0492912,
|
||||
-0.0085287, 0.0400428, 0.9684867]);
|
||||
|
||||
// See http://www.brucelindbloom.com/index.html?Eqn_RGB_XYZ_Matrix.html.
|
||||
// prettier-ignore
|
||||
const SRGB_D65_XYZ_TO_RGB_MATRIX = new Float32Array([
|
||||
3.2404542, -1.5371385, -0.4985314,
|
||||
-0.9692660, 1.8760108, 0.0415560,
|
||||
|
@ -87,6 +87,7 @@ function getInheritableProperty({ dict, key, getArray = false,
|
||||
return values;
|
||||
}
|
||||
|
||||
// prettier-ignore
|
||||
const ROMAN_NUMBER_MAP = [
|
||||
'', 'C', 'CC', 'CCC', 'CD', 'D', 'DC', 'DCC', 'DCCC', 'CM',
|
||||
'', 'X', 'XX', 'XXX', 'XL', 'L', 'LX', 'LXX', 'LXXX', 'XC',
|
||||
|
@ -63,12 +63,14 @@ var ARCFourCipher = (function ARCFourCipherClosure() {
|
||||
})();
|
||||
|
||||
var calculateMD5 = (function calculateMD5Closure() {
|
||||
// prettier-ignore
|
||||
var r = new Uint8Array([
|
||||
7, 12, 17, 22, 7, 12, 17, 22, 7, 12, 17, 22, 7, 12, 17, 22,
|
||||
5, 9, 14, 20, 5, 9, 14, 20, 5, 9, 14, 20, 5, 9, 14, 20,
|
||||
4, 11, 16, 23, 4, 11, 16, 23, 4, 11, 16, 23, 4, 11, 16, 23,
|
||||
6, 10, 15, 21, 6, 10, 15, 21, 6, 10, 15, 21, 6, 10, 15, 21]);
|
||||
|
||||
// prettier-ignore
|
||||
var k = new Int32Array([
|
||||
-680876936, -389564586, 606105819, -1044525330, -176418897, 1200080426,
|
||||
-1473231341, -45705983, 1770035416, -1958414417, -42063, -1990404162,
|
||||
@ -136,6 +138,7 @@ var calculateMD5 = (function calculateMD5Closure() {
|
||||
h2 = (h2 + c) | 0;
|
||||
h3 = (h3 + d) | 0;
|
||||
}
|
||||
// prettier-ignore
|
||||
return new Uint8Array([
|
||||
h0 & 0xFF, (h0 >> 8) & 0xFF, (h0 >> 16) & 0xFF, (h0 >>> 24) & 0xFF,
|
||||
h1 & 0xFF, (h1 >> 8) & 0xFF, (h1 >> 16) & 0xFF, (h1 >>> 24) & 0xFF,
|
||||
@ -263,6 +266,7 @@ var calculateSHA256 = (function calculateSHA256Closure() {
|
||||
return rotr(x, 17) ^ rotr(x, 19) ^ x >>> 10;
|
||||
}
|
||||
|
||||
// prettier-ignore
|
||||
var k = [0x428a2f98, 0x71374491, 0xb5c0fbcf, 0xe9b5dba5,
|
||||
0x3956c25b, 0x59f111f1, 0x923f82a4, 0xab1c5ed5,
|
||||
0xd807aa98, 0x12835b01, 0x243185be, 0x550c7dc3,
|
||||
@ -341,6 +345,7 @@ var calculateSHA256 = (function calculateSHA256Closure() {
|
||||
h6 = (h6 + g) | 0;
|
||||
h7 = (h7 + h) | 0;
|
||||
}
|
||||
// prettier-ignore
|
||||
return new Uint8Array([
|
||||
(h0 >> 24) & 0xFF, (h0 >> 16) & 0xFF, (h0 >> 8) & 0xFF, (h0) & 0xFF,
|
||||
(h1 >> 24) & 0xFF, (h1 >> 16) & 0xFF, (h1 >> 8) & 0xFF, (h1) & 0xFF,
|
||||
@ -421,6 +426,7 @@ var calculateSHA512 = (function calculateSHA512Closure() {
|
||||
result.xor(tmp);
|
||||
}
|
||||
|
||||
// prettier-ignore
|
||||
var k = [
|
||||
new Word64(0x428a2f98, 0xd728ae22), new Word64(0x71374491, 0x23ef65cd),
|
||||
new Word64(0xb5c0fbcf, 0xec4d3b2f), new Word64(0xe9b5dba5, 0x8189dbbc),
|
||||
@ -635,6 +641,7 @@ class AESBaseCipher {
|
||||
unreachable('Cannot initialize AESBaseCipher.');
|
||||
}
|
||||
|
||||
// prettier-ignore
|
||||
this._s = new Uint8Array([
|
||||
0x63, 0x7c, 0x77, 0x7b, 0xf2, 0x6b, 0x6f, 0xc5, 0x30, 0x01, 0x67, 0x2b,
|
||||
0xfe, 0xd7, 0xab, 0x76, 0xca, 0x82, 0xc9, 0x7d, 0xfa, 0x59, 0x47, 0xf0,
|
||||
@ -660,6 +667,7 @@ class AESBaseCipher {
|
||||
0xb0, 0x54, 0xbb, 0x16,
|
||||
]);
|
||||
|
||||
// prettier-ignore
|
||||
this._inv_s = new Uint8Array([
|
||||
0x52, 0x09, 0x6a, 0xd5, 0x30, 0x36, 0xa5, 0x38, 0xbf, 0x40, 0xa3, 0x9e,
|
||||
0x81, 0xf3, 0xd7, 0xfb, 0x7c, 0xe3, 0x39, 0x82, 0x9b, 0x2f, 0xff, 0x87,
|
||||
@ -685,6 +693,7 @@ class AESBaseCipher {
|
||||
0x55, 0x21, 0x0c, 0x7d,
|
||||
]);
|
||||
|
||||
// prettier-ignore
|
||||
this._mix = new Uint32Array([
|
||||
0x00000000, 0x0e090d0b, 0x1c121a16, 0x121b171d, 0x3824342c, 0x362d3927,
|
||||
0x24362e3a, 0x2a3f2331, 0x70486858, 0x7e416553, 0x6c5a724e, 0x62537f45,
|
||||
@ -1040,6 +1049,7 @@ class AES128Cipher extends AESBaseCipher {
|
||||
this._cyclesOfRepetition = 10;
|
||||
this._keySize = 160; // bits
|
||||
|
||||
// prettier-ignore
|
||||
this._rcon = new Uint8Array([
|
||||
0x8d, 0x01, 0x02, 0x04, 0x08, 0x10, 0x20, 0x40, 0x80, 0x1b, 0x36, 0x6c,
|
||||
0xd8, 0xab, 0x4d, 0x9a, 0x2f, 0x5e, 0xbc, 0x63, 0xc6, 0x97, 0x35, 0x6a,
|
||||
@ -1373,6 +1383,7 @@ var CipherTransform = (function CipherTransformClosure() {
|
||||
})();
|
||||
|
||||
var CipherTransformFactory = (function CipherTransformFactoryClosure() {
|
||||
// prettier-ignore
|
||||
var defaultPasswordBytes = new Uint8Array([
|
||||
0x28, 0xBF, 0x4E, 0x5E, 0x4E, 0x75, 0x8A, 0x41,
|
||||
0x64, 0x00, 0x4E, 0x56, 0xFF, 0xFA, 0x01, 0x08,
|
||||
|
@ -345,6 +345,7 @@ class Page {
|
||||
}
|
||||
|
||||
const PDF_HEADER_SIGNATURE = new Uint8Array([0x25, 0x50, 0x44, 0x46, 0x2D]);
|
||||
// prettier-ignore
|
||||
const STARTXREF_SIGNATURE = new Uint8Array([
|
||||
0x73, 0x74, 0x61, 0x72, 0x74, 0x78, 0x72, 0x65, 0x66]);
|
||||
const ENDOBJ_SIGNATURE = new Uint8Array([0x65, 0x6E, 0x64, 0x6F, 0x62, 0x6A]);
|
||||
|
@ -13,6 +13,7 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
// prettier-ignore
|
||||
const ExpertEncoding = [
|
||||
'', '', '', '', '', '', '', '', '', '', '', '', '', '', '',
|
||||
'', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '',
|
||||
@ -56,6 +57,7 @@ const ExpertEncoding = [
|
||||
'Ucircumflexsmall', 'Udieresissmall', 'Yacutesmall', 'Thornsmall',
|
||||
'Ydieresissmall'];
|
||||
|
||||
// prettier-ignore
|
||||
const MacExpertEncoding = [
|
||||
'', '', '', '', '', '', '', '', '', '', '', '', '', '',
|
||||
'', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '',
|
||||
@ -98,6 +100,7 @@ const MacExpertEncoding = [
|
||||
'Macronsmall', 'bsuperior', 'nsuperior', 'msuperior', 'commasuperior',
|
||||
'periodsuperior', 'Dotaccentsmall', 'Ringsmall', '', '', '', ''];
|
||||
|
||||
// prettier-ignore
|
||||
const MacRomanEncoding = [
|
||||
'', '', '', '', '', '', '', '', '', '', '', '', '', '', '',
|
||||
'', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '',
|
||||
@ -134,6 +137,7 @@ const MacRomanEncoding = [
|
||||
'tilde', 'macron', 'breve', 'dotaccent', 'ring', 'cedilla', 'hungarumlaut',
|
||||
'ogonek', 'caron'];
|
||||
|
||||
// prettier-ignore
|
||||
const StandardEncoding = [
|
||||
'', '', '', '', '', '', '', '', '', '', '', '', '', '', '',
|
||||
'', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '',
|
||||
@ -162,6 +166,7 @@ const StandardEncoding = [
|
||||
'', '', '', 'dotlessi', '', '', 'lslash', 'oslash', 'oe', 'germandbls', '',
|
||||
'', '', ''];
|
||||
|
||||
// prettier-ignore
|
||||
const WinAnsiEncoding = [
|
||||
'', '', '', '', '', '', '', '', '', '', '', '', '', '', '',
|
||||
'', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '',
|
||||
@ -198,6 +203,7 @@ const WinAnsiEncoding = [
|
||||
'ugrave', 'uacute', 'ucircumflex', 'udieresis', 'yacute', 'thorn',
|
||||
'ydieresis'];
|
||||
|
||||
// prettier-ignore
|
||||
const SymbolSetEncoding = [
|
||||
'', '', '', '', '', '', '', '', '', '', '', '', '', '',
|
||||
'', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '',
|
||||
@ -236,6 +242,7 @@ const SymbolSetEncoding = [
|
||||
'bracketrightex', 'bracketrightbt', 'bracerighttp', 'bracerightmid',
|
||||
'bracerightbt', ''];
|
||||
|
||||
// prettier-ignore
|
||||
const ZapfDingbatsEncoding = [
|
||||
'', '', '', '', '', '', '', '', '', '', '', '', '', '',
|
||||
'', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '',
|
||||
|
@ -2037,6 +2037,7 @@ var Font = (function FontClosure() {
|
||||
return names;
|
||||
}
|
||||
|
||||
// prettier-ignore
|
||||
var TTOpsStackDeltas = [
|
||||
0, 0, 0, 0, 0, 0, 0, 0, -2, -2, -2, -2, 0, 0, -2, -5,
|
||||
-1, -1, -1, -1, -1, -1, -1, -1, 0, 0, -1, 0, -1, -1, -1, -1,
|
||||
|
@ -73,6 +73,7 @@ var Jbig2Image = (function Jbig2ImageClosure() {
|
||||
}
|
||||
|
||||
var sign = readBits(1);
|
||||
// prettier-ignore
|
||||
var value = readBits(1) ?
|
||||
(readBits(1) ?
|
||||
(readBits(1) ?
|
||||
|
@ -45,6 +45,7 @@ class EOIMarkerError extends BaseException { }
|
||||
*/
|
||||
|
||||
var JpegImage = (function JpegImageClosure() {
|
||||
// prettier-ignore
|
||||
var dctZigZag = new Uint8Array([
|
||||
0,
|
||||
1, 8,
|
||||
@ -1015,6 +1016,7 @@ var JpegImage = (function JpegImageClosure() {
|
||||
// inverting JPEG (CMYK) images if and only if the image data does *not*
|
||||
// come from a PDF file and no `decodeTransform` was passed by the user.
|
||||
if (!isSourcePDF && numComponents === 4 && !transform) {
|
||||
// prettier-ignore
|
||||
transform = new Int32Array([
|
||||
-256, 255, -256, 255, -256, 255, -256, 255]);
|
||||
}
|
||||
|
@ -1616,16 +1616,19 @@ var JpxImage = (function JpxImageClosure() {
|
||||
// Table D-1
|
||||
// The index is binary presentation: 0dddvvhh, ddd - sum of Di (0..4),
|
||||
// vv - sum of Vi (0..2), and hh - sum of Hi (0..2)
|
||||
// prettier-ignore
|
||||
var LLAndLHContextsLabel = new Uint8Array([
|
||||
0, 5, 8, 0, 3, 7, 8, 0, 4, 7, 8, 0, 0, 0, 0, 0, 1, 6, 8, 0, 3, 7, 8, 0, 4,
|
||||
7, 8, 0, 0, 0, 0, 0, 2, 6, 8, 0, 3, 7, 8, 0, 4, 7, 8, 0, 0, 0, 0, 0, 2, 6,
|
||||
8, 0, 3, 7, 8, 0, 4, 7, 8, 0, 0, 0, 0, 0, 2, 6, 8, 0, 3, 7, 8, 0, 4, 7, 8
|
||||
]);
|
||||
// prettier-ignore
|
||||
var HLContextLabel = new Uint8Array([
|
||||
0, 3, 4, 0, 5, 7, 7, 0, 8, 8, 8, 0, 0, 0, 0, 0, 1, 3, 4, 0, 6, 7, 7, 0, 8,
|
||||
8, 8, 0, 0, 0, 0, 0, 2, 3, 4, 0, 6, 7, 7, 0, 8, 8, 8, 0, 0, 0, 0, 0, 2, 3,
|
||||
4, 0, 6, 7, 7, 0, 8, 8, 8, 0, 0, 0, 0, 0, 2, 3, 4, 0, 6, 7, 7, 0, 8, 8, 8
|
||||
]);
|
||||
// prettier-ignore
|
||||
var HHContextLabel = new Uint8Array([
|
||||
0, 1, 2, 0, 1, 2, 2, 0, 2, 2, 2, 0, 0, 0, 0, 0, 3, 4, 5, 0, 4, 5, 5, 0, 5,
|
||||
5, 5, 0, 0, 0, 0, 0, 6, 7, 7, 0, 7, 7, 7, 0, 7, 7, 7, 0, 0, 0, 0, 0, 8, 8,
|
||||
|
@ -1377,6 +1377,7 @@ var XRef = (function XRefClosure() {
|
||||
const CHECK_CONTENT_LENGTH = 25;
|
||||
|
||||
var trailerBytes = new Uint8Array([116, 114, 97, 105, 108, 101, 114]);
|
||||
// prettier-ignore
|
||||
var startxrefBytes = new Uint8Array([115, 116, 97, 114, 116, 120, 114,
|
||||
101, 102]);
|
||||
const objBytes = new Uint8Array([111, 98, 106]);
|
||||
|
@ -565,6 +565,7 @@ class Parser {
|
||||
this.shift(); // 'stream'
|
||||
} else {
|
||||
// Bad stream length, scanning for endstream command.
|
||||
// prettier-ignore
|
||||
const ENDSTREAM_SIGNATURE = new Uint8Array([
|
||||
0x65, 0x6E, 0x64, 0x73, 0x74, 0x72, 0x65, 0x61, 0x6D]);
|
||||
let actualLength = this._findStreamLength(startPos,
|
||||
@ -724,6 +725,7 @@ class Parser {
|
||||
|
||||
// A '1' in this array means the character is white space. A '1' or
|
||||
// '2' means the character ends a name or command.
|
||||
// prettier-ignore
|
||||
const specialChars = [
|
||||
1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 1, 1, 0, 0, // 0x
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 1x
|
||||
|
@ -514,6 +514,7 @@ Shadings.Mesh = (function MeshClosure() {
|
||||
}
|
||||
var tmp1, tmp2, tmp3, tmp4;
|
||||
switch (f) {
|
||||
// prettier-ignore
|
||||
case 0:
|
||||
ps[12] = pi + 3; ps[13] = pi + 4; ps[14] = pi + 5; ps[15] = pi + 6;
|
||||
ps[ 8] = pi + 2; /* values for 5, 6, 9, 10 are */ ps[11] = pi + 7;
|
||||
@ -522,6 +523,7 @@ Shadings.Mesh = (function MeshClosure() {
|
||||
cs[2] = ci + 1; cs[3] = ci + 2;
|
||||
cs[0] = ci; cs[1] = ci + 3;
|
||||
break;
|
||||
// prettier-ignore
|
||||
case 1:
|
||||
tmp1 = ps[12]; tmp2 = ps[13]; tmp3 = ps[14]; tmp4 = ps[15];
|
||||
ps[12] = tmp4; ps[13] = pi + 0; ps[14] = pi + 1; ps[15] = pi + 2;
|
||||
@ -532,6 +534,7 @@ Shadings.Mesh = (function MeshClosure() {
|
||||
cs[2] = tmp2; cs[3] = ci;
|
||||
cs[0] = tmp1; cs[1] = ci + 1;
|
||||
break;
|
||||
// prettier-ignore
|
||||
case 2:
|
||||
tmp1 = ps[15];
|
||||
tmp2 = ps[11];
|
||||
@ -543,6 +546,7 @@ Shadings.Mesh = (function MeshClosure() {
|
||||
cs[2] = cs[1]; cs[3] = ci;
|
||||
cs[0] = tmp1; cs[1] = ci + 1;
|
||||
break;
|
||||
// prettier-ignore
|
||||
case 3:
|
||||
ps[12] = ps[0]; ps[13] = pi + 0; ps[14] = pi + 1; ps[15] = pi + 2;
|
||||
ps[ 8] = ps[1]; /* values for 5, 6, 9, 10 are */ ps[11] = pi + 3;
|
||||
@ -626,6 +630,7 @@ Shadings.Mesh = (function MeshClosure() {
|
||||
}
|
||||
var tmp1, tmp2, tmp3, tmp4;
|
||||
switch (f) {
|
||||
// prettier-ignore
|
||||
case 0:
|
||||
ps[12] = pi + 3; ps[13] = pi + 4; ps[14] = pi + 5; ps[15] = pi + 6;
|
||||
ps[ 8] = pi + 2; ps[ 9] = pi + 13; ps[10] = pi + 14; ps[11] = pi + 7;
|
||||
@ -634,6 +639,7 @@ Shadings.Mesh = (function MeshClosure() {
|
||||
cs[2] = ci + 1; cs[3] = ci + 2;
|
||||
cs[0] = ci; cs[1] = ci + 3;
|
||||
break;
|
||||
// prettier-ignore
|
||||
case 1:
|
||||
tmp1 = ps[12]; tmp2 = ps[13]; tmp3 = ps[14]; tmp4 = ps[15];
|
||||
ps[12] = tmp4; ps[13] = pi + 0; ps[14] = pi + 1; ps[15] = pi + 2;
|
||||
@ -644,6 +650,7 @@ Shadings.Mesh = (function MeshClosure() {
|
||||
cs[2] = tmp2; cs[3] = ci;
|
||||
cs[0] = tmp1; cs[1] = ci + 1;
|
||||
break;
|
||||
// prettier-ignore
|
||||
case 2:
|
||||
tmp1 = ps[15];
|
||||
tmp2 = ps[11];
|
||||
@ -655,6 +662,7 @@ Shadings.Mesh = (function MeshClosure() {
|
||||
cs[2] = cs[1]; cs[3] = ci;
|
||||
cs[0] = tmp1; cs[1] = ci + 1;
|
||||
break;
|
||||
// prettier-ignore
|
||||
case 3:
|
||||
ps[12] = ps[0]; ps[13] = pi + 0; ps[14] = pi + 1; ps[15] = pi + 2;
|
||||
ps[ 8] = ps[1]; ps[ 9] = pi + 9; ps[10] = pi + 10; ps[11] = pi + 3;
|
||||
|
@ -330,10 +330,12 @@ var StreamsSequenceStream = (function StreamsSequenceStreamClosure() {
|
||||
})();
|
||||
|
||||
var FlateStream = (function FlateStreamClosure() {
|
||||
// prettier-ignore
|
||||
var codeLenCodeMap = new Int32Array([
|
||||
16, 17, 18, 0, 8, 7, 9, 6, 10, 5, 11, 4, 12, 3, 13, 2, 14, 1, 15
|
||||
]);
|
||||
|
||||
// prettier-ignore
|
||||
var lengthDecode = new Int32Array([
|
||||
0x00003, 0x00004, 0x00005, 0x00006, 0x00007, 0x00008, 0x00009, 0x0000a,
|
||||
0x1000b, 0x1000d, 0x1000f, 0x10011, 0x20013, 0x20017, 0x2001b, 0x2001f,
|
||||
@ -341,6 +343,7 @@ var FlateStream = (function FlateStreamClosure() {
|
||||
0x50083, 0x500a3, 0x500c3, 0x500e3, 0x00102, 0x00102, 0x00102
|
||||
]);
|
||||
|
||||
// prettier-ignore
|
||||
var distDecode = new Int32Array([
|
||||
0x00001, 0x00002, 0x00003, 0x00004, 0x10005, 0x10007, 0x20009, 0x2000d,
|
||||
0x30011, 0x30019, 0x40021, 0x40031, 0x50041, 0x50061, 0x60081, 0x600c1,
|
||||
@ -348,6 +351,7 @@ var FlateStream = (function FlateStreamClosure() {
|
||||
0xb1001, 0xb1801, 0xc2001, 0xc3001, 0xd4001, 0xd6001
|
||||
]);
|
||||
|
||||
// prettier-ignore
|
||||
var fixedLitCodeTab = [new Int32Array([
|
||||
0x70100, 0x80050, 0x80010, 0x80118, 0x70110, 0x80070, 0x80030, 0x900c0,
|
||||
0x70108, 0x80060, 0x80020, 0x900a0, 0x80000, 0x80080, 0x80040, 0x900e0,
|
||||
@ -415,6 +419,7 @@ var FlateStream = (function FlateStreamClosure() {
|
||||
0x7010f, 0x8006f, 0x8002f, 0x900bf, 0x8000f, 0x8008f, 0x8004f, 0x900ff
|
||||
]), 9];
|
||||
|
||||
// prettier-ignore
|
||||
var fixedDistCodeTab = [new Int32Array([
|
||||
0x50000, 0x50010, 0x50008, 0x50018, 0x50004, 0x50014, 0x5000c, 0x5001c,
|
||||
0x50002, 0x50012, 0x5000a, 0x5001a, 0x50006, 0x50016, 0x5000e, 0x00000,
|
||||
|
@ -198,6 +198,7 @@ function compileType3Glyph(imgData) {
|
||||
var width = imgData.width, height = imgData.height;
|
||||
var i, j, j0, width1 = width + 1;
|
||||
var points = new Uint8Array(width1 * (height + 1));
|
||||
// prettier-ignore
|
||||
var POINT_TYPES =
|
||||
new Uint8Array([0, 2, 4, 0, 1, 0, 5, 4, 8, 10, 0, 8, 0, 2, 1, 0]);
|
||||
|
||||
|
@ -178,6 +178,7 @@ var WebGLUtils = (function WebGLUtilsClosure() {
|
||||
// provide texture coordinates for the rectangle.
|
||||
var texCoordBuffer = gl.createBuffer();
|
||||
gl.bindBuffer(gl.ARRAY_BUFFER, texCoordBuffer);
|
||||
// prettier-ignore
|
||||
gl.bufferData(gl.ARRAY_BUFFER, new Float32Array([
|
||||
0.0, 0.0,
|
||||
1.0, 0.0,
|
||||
@ -223,6 +224,7 @@ var WebGLUtils = (function WebGLUtilsClosure() {
|
||||
// it (2 triangles)
|
||||
var buffer = gl.createBuffer();
|
||||
gl.bindBuffer(gl.ARRAY_BUFFER, buffer);
|
||||
// prettier-ignore
|
||||
gl.bufferData(gl.ARRAY_BUFFER, new Float32Array([
|
||||
0, 0,
|
||||
width, 0,
|
||||
|
@ -731,6 +731,7 @@ class Util {
|
||||
}
|
||||
}
|
||||
|
||||
// prettier-ignore
|
||||
const PDFStringTranslateTable = [
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0x2D8, 0x2C7, 0x2C6, 0x2D9, 0x2DD, 0x2DB, 0x2DA, 0x2DC, 0, 0, 0, 0, 0, 0, 0,
|
||||
|
@ -120,6 +120,7 @@ describe('CFFParser', function() {
|
||||
|
||||
it('ignores reserved commands in parseDict, and refuses to add privateDict ' +
|
||||
'keys with invalid values (bug 1308536)', function () {
|
||||
// prettier-ignore
|
||||
var bytes = new Uint8Array([
|
||||
64, 39, 31, 30, 252, 114, 137, 115, 79, 30, 197, 119, 2, 99, 127, 6
|
||||
]);
|
||||
@ -137,6 +138,7 @@ describe('CFFParser', function() {
|
||||
});
|
||||
|
||||
it('parses a CharString having cntrmask', function() {
|
||||
// prettier-ignore
|
||||
var bytes = new Uint8Array([0, 1, // count
|
||||
1, // offsetSize
|
||||
0, // offset[0]
|
||||
@ -167,6 +169,7 @@ describe('CFFParser', function() {
|
||||
/* seacAnalysisEnabled = */ true);
|
||||
parser.parse(); // cff
|
||||
|
||||
// prettier-ignore
|
||||
var bytes = new Uint8Array([0, 1, // count
|
||||
1, // offsetSize
|
||||
0, // offset[0]
|
||||
@ -192,6 +195,7 @@ describe('CFFParser', function() {
|
||||
/* seacAnalysisEnabled = */ false);
|
||||
parser.parse(); // cff
|
||||
|
||||
// prettier-ignore
|
||||
var bytes = new Uint8Array([0, 1, // count
|
||||
1, // offsetSize
|
||||
0, // offset[0]
|
||||
@ -208,6 +212,7 @@ describe('CFFParser', function() {
|
||||
});
|
||||
|
||||
it('parses a CharString endchar no args', function() {
|
||||
// prettier-ignore
|
||||
var bytes = new Uint8Array([0, 1, // count
|
||||
1, // offsetSize
|
||||
0, // offset[0]
|
||||
@ -230,6 +235,7 @@ describe('CFFParser', function() {
|
||||
|
||||
it('parses charset format 0', function() {
|
||||
// The first three bytes make the offset large enough to skip predefined.
|
||||
// prettier-ignore
|
||||
var bytes = new Uint8Array([0x00, 0x00, 0x00,
|
||||
0x00, // format
|
||||
0x00, 0x02 // sid/cid
|
||||
@ -245,6 +251,7 @@ describe('CFFParser', function() {
|
||||
|
||||
it('parses charset format 1', function() {
|
||||
// The first three bytes make the offset large enough to skip predefined.
|
||||
// prettier-ignore
|
||||
var bytes = new Uint8Array([0x00, 0x00, 0x00,
|
||||
0x01, // format
|
||||
0x00, 0x08, // sid/cid start
|
||||
@ -262,6 +269,7 @@ describe('CFFParser', function() {
|
||||
it('parses charset format 2', function() {
|
||||
// format 2 is the same as format 1 but the left is card16
|
||||
// The first three bytes make the offset large enough to skip predefined.
|
||||
// prettier-ignore
|
||||
var bytes = new Uint8Array([0x00, 0x00, 0x00,
|
||||
0x02, // format
|
||||
0x00, 0x08, // sid/cid start
|
||||
@ -278,6 +286,7 @@ describe('CFFParser', function() {
|
||||
|
||||
it('parses encoding format 0', function() {
|
||||
// The first two bytes make the offset large enough to skip predefined.
|
||||
// prettier-ignore
|
||||
var bytes = new Uint8Array([0x00, 0x00,
|
||||
0x00, // format
|
||||
0x01, // count
|
||||
@ -290,6 +299,7 @@ describe('CFFParser', function() {
|
||||
|
||||
it('parses encoding format 1', function() {
|
||||
// The first two bytes make the offset large enough to skip predefined.
|
||||
// prettier-ignore
|
||||
var bytes = new Uint8Array([0x00, 0x00,
|
||||
0x01, // format
|
||||
0x01, // num ranges
|
||||
@ -303,6 +313,7 @@ describe('CFFParser', function() {
|
||||
});
|
||||
|
||||
it('parses fdselect format 0', function() {
|
||||
// prettier-ignore
|
||||
var bytes = new Uint8Array([0x00, // format
|
||||
0x00, // gid: 0 fd: 0
|
||||
0x01 // gid: 1 fd: 1
|
||||
@ -315,6 +326,7 @@ describe('CFFParser', function() {
|
||||
});
|
||||
|
||||
it('parses fdselect format 3', function() {
|
||||
// prettier-ignore
|
||||
var bytes = new Uint8Array([0x03, // format
|
||||
0x00, 0x02, // range count
|
||||
0x00, 0x00, // first gid
|
||||
@ -331,6 +343,7 @@ describe('CFFParser', function() {
|
||||
});
|
||||
|
||||
it('parses invalid fdselect format 3 (bug 1146106)', function() {
|
||||
// prettier-ignore
|
||||
var bytes = new Uint8Array([0x03, // format
|
||||
0x00, 0x02, // range count
|
||||
0x00, 0x01, // first gid (invalid)
|
||||
|
@ -57,6 +57,7 @@ describe('cmap', function() {
|
||||
});
|
||||
|
||||
it('parses beginbfchar', function(done) {
|
||||
// prettier-ignore
|
||||
var str = '2 beginbfchar\n' +
|
||||
'<03> <00>\n' +
|
||||
'<04> <01>\n' +
|
||||
@ -73,6 +74,7 @@ describe('cmap', function() {
|
||||
});
|
||||
});
|
||||
it('parses beginbfrange with range', function(done) {
|
||||
// prettier-ignore
|
||||
var str = '1 beginbfrange\n' +
|
||||
'<06> <0B> 0\n' +
|
||||
'endbfrange\n';
|
||||
@ -89,6 +91,7 @@ describe('cmap', function() {
|
||||
});
|
||||
});
|
||||
it('parses beginbfrange with array', function(done) {
|
||||
// prettier-ignore
|
||||
var str = '1 beginbfrange\n' +
|
||||
'<0D> <12> [ 0 1 2 3 4 5 ]\n' +
|
||||
'endbfrange\n';
|
||||
@ -105,6 +108,7 @@ describe('cmap', function() {
|
||||
});
|
||||
});
|
||||
it('parses begincidchar', function(done) {
|
||||
// prettier-ignore
|
||||
var str = '1 begincidchar\n' +
|
||||
'<14> 0\n' +
|
||||
'endcidchar\n';
|
||||
@ -119,6 +123,7 @@ describe('cmap', function() {
|
||||
});
|
||||
});
|
||||
it('parses begincidrange', function(done) {
|
||||
// prettier-ignore
|
||||
var str = '1 begincidrange\n' +
|
||||
'<0016> <001B> 0\n' +
|
||||
'endcidrange\n';
|
||||
@ -135,6 +140,7 @@ describe('cmap', function() {
|
||||
});
|
||||
});
|
||||
it('decodes codespace ranges', function(done) {
|
||||
// prettier-ignore
|
||||
var str = '1 begincodespacerange\n' +
|
||||
'<01> <02>\n' +
|
||||
'<00000003> <00000004>\n' +
|
||||
@ -155,6 +161,7 @@ describe('cmap', function() {
|
||||
});
|
||||
});
|
||||
it('decodes 4 byte codespace ranges', function(done) {
|
||||
// prettier-ignore
|
||||
var str = '1 begincodespacerange\n' +
|
||||
'<8EA1A1A1> <8EA1FEFE>\n' +
|
||||
'endcodespacerange\n';
|
||||
|
@ -62,6 +62,7 @@ describe('colorspace', function () {
|
||||
|
||||
let testSrc = new Uint8Array([27, 125, 250, 131]);
|
||||
let testDest = new Uint8ClampedArray(4 * 4 * 3);
|
||||
// prettier-ignore
|
||||
let expectedDest = new Uint8ClampedArray([
|
||||
27, 27, 27,
|
||||
27, 27, 27,
|
||||
@ -103,6 +104,7 @@ describe('colorspace', function () {
|
||||
|
||||
let testSrc = new Uint8Array([27, 125, 250, 131]);
|
||||
let testDest = new Uint8ClampedArray(3 * 3 * 3);
|
||||
// prettier-ignore
|
||||
let expectedDest = new Uint8ClampedArray([
|
||||
27, 27, 27,
|
||||
27, 27, 27,
|
||||
@ -138,6 +140,7 @@ describe('colorspace', function () {
|
||||
});
|
||||
let colorSpace = ColorSpace.parse(cs, xref, res, pdfFunctionFactory);
|
||||
|
||||
// prettier-ignore
|
||||
let testSrc = new Uint8Array([
|
||||
27, 125, 250,
|
||||
131, 139, 140,
|
||||
@ -145,6 +148,7 @@ describe('colorspace', function () {
|
||||
21, 147, 255
|
||||
]);
|
||||
let testDest = new Uint8ClampedArray(4 * 4 * 3);
|
||||
// prettier-ignore
|
||||
let expectedDest = new Uint8ClampedArray([
|
||||
27, 125, 250,
|
||||
27, 125, 250,
|
||||
@ -184,6 +188,7 @@ describe('colorspace', function () {
|
||||
});
|
||||
let colorSpace = ColorSpace.parse(cs, xref, res, pdfFunctionFactory);
|
||||
|
||||
// prettier-ignore
|
||||
let testSrc = new Uint8Array([
|
||||
27, 125, 250,
|
||||
131, 139, 140,
|
||||
@ -191,6 +196,7 @@ describe('colorspace', function () {
|
||||
21, 147, 255
|
||||
]);
|
||||
let testDest = new Uint8ClampedArray(3 * 3 * 3);
|
||||
// prettier-ignore
|
||||
let expectedDest = new Uint8ClampedArray([
|
||||
27, 125, 250,
|
||||
27, 125, 250,
|
||||
@ -226,6 +232,7 @@ describe('colorspace', function () {
|
||||
});
|
||||
let colorSpace = ColorSpace.parse(cs, xref, res, pdfFunctionFactory);
|
||||
|
||||
// prettier-ignore
|
||||
let testSrc = new Uint8Array([
|
||||
27, 125, 250, 128,
|
||||
131, 139, 140, 45,
|
||||
@ -233,6 +240,7 @@ describe('colorspace', function () {
|
||||
21, 147, 255, 69
|
||||
]);
|
||||
let testDest = new Uint8ClampedArray(4 * 4 * 3);
|
||||
// prettier-ignore
|
||||
let expectedDest = new Uint8ClampedArray([
|
||||
135, 81, 18,
|
||||
135, 81, 18,
|
||||
@ -272,6 +280,7 @@ describe('colorspace', function () {
|
||||
});
|
||||
let colorSpace = ColorSpace.parse(cs, xref, res, pdfFunctionFactory);
|
||||
|
||||
// prettier-ignore
|
||||
let testSrc = new Uint8Array([
|
||||
27, 125, 250, 128,
|
||||
131, 139, 140, 45,
|
||||
@ -279,6 +288,7 @@ describe('colorspace', function () {
|
||||
21, 147, 255, 69
|
||||
]);
|
||||
let testDest = new Uint8ClampedArray(3 * 3 * 3);
|
||||
// prettier-ignore
|
||||
let expectedDest = new Uint8ClampedArray([
|
||||
135, 81, 18,
|
||||
135, 81, 18,
|
||||
@ -324,6 +334,7 @@ describe('colorspace', function () {
|
||||
|
||||
let testSrc = new Uint8Array([27, 125, 250, 131]);
|
||||
let testDest = new Uint8ClampedArray(4 * 4 * 3);
|
||||
// prettier-ignore
|
||||
let expectedDest = new Uint8ClampedArray([
|
||||
25, 25, 25,
|
||||
25, 25, 25,
|
||||
@ -375,6 +386,7 @@ describe('colorspace', function () {
|
||||
});
|
||||
let colorSpace = ColorSpace.parse(cs, xref, res, pdfFunctionFactory);
|
||||
|
||||
// prettier-ignore
|
||||
let testSrc = new Uint8Array([
|
||||
27, 125, 250,
|
||||
131, 139, 140,
|
||||
@ -382,6 +394,7 @@ describe('colorspace', function () {
|
||||
21, 147, 255
|
||||
]);
|
||||
let testDest = new Uint8ClampedArray(3 * 3 * 3);
|
||||
// prettier-ignore
|
||||
let expectedDest = new Uint8ClampedArray([
|
||||
0, 238, 255,
|
||||
0, 238, 255,
|
||||
@ -425,6 +438,7 @@ describe('colorspace', function () {
|
||||
});
|
||||
let colorSpace = ColorSpace.parse(cs, xref, res, pdfFunctionFactory);
|
||||
|
||||
// prettier-ignore
|
||||
let testSrc = new Uint8Array([
|
||||
27, 25, 50,
|
||||
31, 19, 40,
|
||||
@ -432,6 +446,7 @@ describe('colorspace', function () {
|
||||
21, 47, 55
|
||||
]);
|
||||
let testDest = new Uint8ClampedArray(3 * 3 * 3);
|
||||
// prettier-ignore
|
||||
let expectedDest = new Uint8ClampedArray([
|
||||
0, 49, 101,
|
||||
0, 49, 101,
|
||||
@ -456,6 +471,7 @@ describe('colorspace', function () {
|
||||
|
||||
describe('IndexedCS', function () {
|
||||
it('should handle the case when cs is an array', function () {
|
||||
// prettier-ignore
|
||||
let lookup = new Uint8Array([
|
||||
23, 155, 35,
|
||||
147, 69, 93,
|
||||
@ -480,6 +496,7 @@ describe('colorspace', function () {
|
||||
|
||||
let testSrc = new Uint8Array([2, 2, 0, 1]);
|
||||
let testDest = new Uint8ClampedArray(3 * 3 * 3);
|
||||
// prettier-ignore
|
||||
let expectedDest = new Uint8ClampedArray([
|
||||
255, 109, 70,
|
||||
255, 109, 70,
|
||||
@ -536,6 +553,7 @@ describe('colorspace', function () {
|
||||
|
||||
let testSrc = new Uint8Array([27, 25, 50, 31]);
|
||||
let testDest = new Uint8ClampedArray(3 * 3 * 3);
|
||||
// prettier-ignore
|
||||
let expectedDest = new Uint8ClampedArray([
|
||||
226, 242, 241,
|
||||
226, 242, 241,
|
||||
|
@ -334,6 +334,7 @@ describe('crypto', function() {
|
||||
alg = new PDF17();
|
||||
password = new Uint8Array([117, 115, 101, 114]);
|
||||
userValidation = new Uint8Array([117, 169, 4, 32, 159, 101, 22, 220]);
|
||||
// prettier-ignore
|
||||
userPassword = new Uint8Array([131, 242, 143, 160, 87, 2, 138, 134, 79,
|
||||
253, 189, 173, 224, 73, 144, 241, 190, 81,
|
||||
197, 15, 249, 105, 145, 151, 15, 194, 65,
|
||||
@ -347,10 +348,12 @@ describe('crypto', function() {
|
||||
alg = new PDF17();
|
||||
password = new Uint8Array([111, 119, 110, 101, 114]);
|
||||
ownerValidation = new Uint8Array([243, 118, 71, 153, 128, 17, 101, 62]);
|
||||
// prettier-ignore
|
||||
ownerPassword = new Uint8Array([60, 98, 137, 35, 51, 101, 200, 152, 210,
|
||||
178, 226, 228, 134, 205, 163, 24, 204,
|
||||
126, 177, 36, 106, 50, 36, 125, 210, 172,
|
||||
171, 120, 222, 108, 139, 115]);
|
||||
// prettier-ignore
|
||||
uBytes = new Uint8Array([131, 242, 143, 160, 87, 2, 138, 134, 79, 253,
|
||||
189, 173, 224, 73, 144, 241, 190, 81, 197, 15,
|
||||
249, 105, 145, 151, 15, 194, 65, 3, 1, 126, 187,
|
||||
@ -366,11 +369,13 @@ describe('crypto', function() {
|
||||
alg = new PDF17();
|
||||
password = new Uint8Array([117, 115, 101, 114]);
|
||||
userKeySalt = new Uint8Array([168, 94, 215, 192, 100, 38, 188, 40]);
|
||||
// prettier-ignore
|
||||
userEncryption = new Uint8Array([35, 150, 195, 169, 245, 51, 51, 255,
|
||||
158, 158, 33, 242, 231, 75, 125, 190,
|
||||
25, 126, 172, 114, 195, 244, 137, 245,
|
||||
234, 165, 42, 74, 60, 38, 17, 17]);
|
||||
result = alg.getUserKey(password, userKeySalt, userEncryption);
|
||||
// prettier-ignore
|
||||
expected = new Uint8Array([63, 114, 136, 209, 87, 61, 12, 30, 249, 1,
|
||||
186, 144, 254, 248, 163, 153, 151, 51, 133,
|
||||
10, 80, 152, 206, 15, 72, 187, 231, 33, 224,
|
||||
@ -384,16 +389,19 @@ describe('crypto', function() {
|
||||
alg = new PDF17();
|
||||
password = new Uint8Array([111, 119, 110, 101, 114]);
|
||||
ownerKeySalt = new Uint8Array([200, 245, 242, 12, 218, 123, 24, 120]);
|
||||
// prettier-ignore
|
||||
ownerEncryption = new Uint8Array([213, 202, 14, 189, 110, 76, 70, 191, 6,
|
||||
195, 10, 190, 157, 100, 144, 85, 8, 62,
|
||||
123, 178, 156, 229, 50, 40, 229, 216,
|
||||
54, 222, 34, 38, 106, 223]);
|
||||
// prettier-ignore
|
||||
uBytes = new Uint8Array([131, 242, 143, 160, 87, 2, 138, 134, 79, 253,
|
||||
189, 173, 224, 73, 144, 241, 190, 81, 197, 15,
|
||||
249, 105, 145, 151, 15, 194, 65, 3, 1, 126, 187,
|
||||
221, 117, 169, 4, 32, 159, 101, 22, 220, 168,
|
||||
94, 215, 192, 100, 38, 188, 40]);
|
||||
result = alg.getOwnerKey(password, ownerKeySalt, uBytes, ownerEncryption);
|
||||
// prettier-ignore
|
||||
expected = new Uint8Array([63, 114, 136, 209, 87, 61, 12, 30, 249, 1,
|
||||
186, 144, 254, 248, 163, 153, 151, 51, 133,
|
||||
10, 80, 152, 206, 15, 72, 187, 231, 33, 224,
|
||||
@ -408,6 +416,7 @@ describe('crypto', function() {
|
||||
alg = new PDF20();
|
||||
password = new Uint8Array([117, 115, 101, 114]);
|
||||
userValidation = new Uint8Array([83, 245, 146, 101, 198, 247, 34, 198]);
|
||||
// prettier-ignore
|
||||
userPassword = new Uint8Array([94, 230, 205, 75, 166, 99, 250, 76, 219,
|
||||
128, 17, 85, 57, 17, 33, 164, 150, 46,
|
||||
103, 176, 160, 156, 187, 233, 166, 223,
|
||||
@ -421,10 +430,12 @@ describe('crypto', function() {
|
||||
alg = new PDF20();
|
||||
password = new Uint8Array([111, 119, 110, 101, 114]);
|
||||
ownerValidation = new Uint8Array([142, 232, 169, 208, 202, 214, 5, 185]);
|
||||
// prettier-ignore
|
||||
ownerPassword = new Uint8Array([88, 232, 62, 54, 245, 26, 245, 209, 137,
|
||||
123, 221, 72, 199, 49, 37, 217, 31, 74,
|
||||
115, 167, 127, 158, 176, 77, 45, 163, 87,
|
||||
47, 39, 90, 217, 141]);
|
||||
// prettier-ignore
|
||||
uBytes = new Uint8Array([94, 230, 205, 75, 166, 99, 250, 76, 219, 128,
|
||||
17, 85, 57, 17, 33, 164, 150, 46, 103, 176, 160,
|
||||
156, 187, 233, 166, 223, 163, 253, 147, 235, 95,
|
||||
@ -440,11 +451,13 @@ describe('crypto', function() {
|
||||
alg = new PDF20();
|
||||
password = new Uint8Array([117, 115, 101, 114]);
|
||||
userKeySalt = new Uint8Array([191, 11, 16, 94, 237, 216, 20, 175]);
|
||||
// prettier-ignore
|
||||
userEncryption = new Uint8Array([121, 208, 2, 181, 230, 89, 156, 60, 253,
|
||||
143, 212, 28, 84, 180, 196, 177, 173,
|
||||
128, 221, 107, 46, 20, 94, 186, 135, 51,
|
||||
95, 24, 20, 223, 254, 36]);
|
||||
result = alg.getUserKey(password, userKeySalt, userEncryption);
|
||||
// prettier-ignore
|
||||
expected = new Uint8Array([42, 218, 213, 39, 73, 91, 72, 79, 67, 38, 248,
|
||||
133, 18, 189, 61, 34, 107, 79, 29, 56, 59,
|
||||
181, 213, 118, 113, 34, 65, 210, 87, 174, 22,
|
||||
@ -458,16 +471,19 @@ describe('crypto', function() {
|
||||
alg = new PDF20();
|
||||
password = new Uint8Array([111, 119, 110, 101, 114]);
|
||||
ownerKeySalt = new Uint8Array([29, 208, 185, 46, 11, 76, 135, 149]);
|
||||
// prettier-ignore
|
||||
ownerEncryption = new Uint8Array([209, 73, 224, 77, 103, 155, 201, 181,
|
||||
190, 68, 223, 20, 62, 90, 56, 210, 5,
|
||||
240, 178, 128, 238, 124, 68, 254, 253,
|
||||
244, 62, 108, 208, 135, 10, 251]);
|
||||
// prettier-ignore
|
||||
uBytes = new Uint8Array([94, 230, 205, 75, 166, 99, 250, 76, 219, 128,
|
||||
17, 85, 57, 17, 33, 164, 150, 46, 103, 176, 160,
|
||||
156, 187, 233, 166, 223, 163, 253, 147, 235, 95,
|
||||
184, 83, 245, 146, 101, 198, 247, 34, 198, 191,
|
||||
11, 16, 94, 237, 216, 20, 175]);
|
||||
result = alg.getOwnerKey(password, ownerKeySalt, uBytes, ownerEncryption);
|
||||
// prettier-ignore
|
||||
expected = new Uint8Array([42, 218, 213, 39, 73, 91, 72, 79, 67, 38, 248,
|
||||
133, 18, 189, 61, 34, 107, 79, 29, 56, 59,
|
||||
181, 213, 118, 113, 34, 65, 210, 87, 174, 22,
|
||||
|
@ -214,6 +214,7 @@ describe('parser', function() {
|
||||
describe('Linearization', function() {
|
||||
it('should not find a linearization dictionary', function() {
|
||||
// Not an actual linearization dictionary.
|
||||
// prettier-ignore
|
||||
const stream1 = new StringStream(
|
||||
'3 0 obj\n' +
|
||||
'<<\n' +
|
||||
@ -225,6 +226,7 @@ describe('parser', function() {
|
||||
expect(Linearization.create(stream1)).toEqual(null);
|
||||
|
||||
// Linearization dictionary with invalid version number.
|
||||
// prettier-ignore
|
||||
const stream2 = new StringStream(
|
||||
'1 0 obj\n' +
|
||||
'<<\n' +
|
||||
@ -236,6 +238,7 @@ describe('parser', function() {
|
||||
});
|
||||
|
||||
it('should accept a valid linearization dictionary', function() {
|
||||
// prettier-ignore
|
||||
const stream = new StringStream(
|
||||
'131 0 obj\n' +
|
||||
'<<\n' +
|
||||
@ -264,6 +267,7 @@ describe('parser', function() {
|
||||
it('should reject a linearization dictionary with invalid ' +
|
||||
'integer parameters', function() {
|
||||
// The /L parameter should be equal to the stream length.
|
||||
// prettier-ignore
|
||||
const stream1 = new StringStream(
|
||||
'1 0 obj\n' +
|
||||
'<<\n' +
|
||||
@ -283,6 +287,7 @@ describe('parser', function() {
|
||||
'dictionary does not equal the stream length.'));
|
||||
|
||||
// The /E parameter should not be zero.
|
||||
// prettier-ignore
|
||||
const stream2 = new StringStream(
|
||||
'1 0 obj\n' +
|
||||
'<<\n' +
|
||||
@ -302,6 +307,7 @@ describe('parser', function() {
|
||||
'dictionary is invalid.'));
|
||||
|
||||
// The /O parameter should be an integer.
|
||||
// prettier-ignore
|
||||
const stream3 = new StringStream(
|
||||
'1 0 obj\n' +
|
||||
'<<\n' +
|
||||
@ -324,6 +330,7 @@ describe('parser', function() {
|
||||
it('should reject a linearization dictionary with invalid hint parameters',
|
||||
function() {
|
||||
// The /H parameter should be an array.
|
||||
// prettier-ignore
|
||||
const stream1 = new StringStream(
|
||||
'1 0 obj\n' +
|
||||
'<<\n' +
|
||||
@ -343,6 +350,7 @@ describe('parser', function() {
|
||||
'is invalid.'));
|
||||
|
||||
// The hint array should contain two, or four, elements.
|
||||
// prettier-ignore
|
||||
const stream2 = new StringStream(
|
||||
'1 0 obj\n' +
|
||||
'<<\n' +
|
||||
@ -362,6 +370,7 @@ describe('parser', function() {
|
||||
'is invalid.'));
|
||||
|
||||
// The hint array should not contain zero.
|
||||
// prettier-ignore
|
||||
const stream3 = new StringStream(
|
||||
'1 0 obj\n' +
|
||||
'<<\n' +
|
||||
|
Loading…
Reference in New Issue
Block a user