Enable the dot-notation
ESLint rule
*Please note:* These changes were done automatically, using the `gulp lint --fix` command. This rule is already enabled in mozilla-central, see https://searchfox.org/mozilla-central/rev/567b68b8ff4b6d607ba34a6f1926873d21a7b4d7/tools/lint/eslint/eslint-plugin-mozilla/lib/configs/recommended.js#103-104 The main advantage, besides improved consistency, of this rule is that it reduces the size of the code (by 3 bytes for each case). In the PDF.js code-base there's close to 8000 instances being fixed by the `dot-notation` ESLint rule, which end up reducing the size of even the *built* files significantly; the total size of the `gulp mozcentral` build target changes from `3 247 456` to `3 224 278` bytes, which is a *reduction* of `23 178` bytes (or ~0.7%) for a completely mechanical change. A large number of these changes affect the (large) lookup tables used on the worker-thread, but given that they are still initialized lazily I don't *think* that the new formatting this patch introduces should undo any of the improvements from PR 6915. Please find additional details about the ESLint rule at https://eslint.org/docs/rules/dot-notation
This commit is contained in:
parent
c218e94f66
commit
1cc3dbb694
@ -75,6 +75,7 @@
|
|||||||
}],
|
}],
|
||||||
"consistent-return": "error",
|
"consistent-return": "error",
|
||||||
"curly": ["error", "all"],
|
"curly": ["error", "all"],
|
||||||
|
"dot-notation": "error",
|
||||||
"eqeqeq": ["error", "always"],
|
"eqeqeq": ["error", "always"],
|
||||||
"no-caller": "error",
|
"no-caller": "error",
|
||||||
"no-else-return": "error",
|
"no-else-return": "error",
|
||||||
|
@ -209,8 +209,8 @@ var PDFViewerApplication = {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!pdfTitle && info && info["Title"]) {
|
if (!pdfTitle && info && info.Title) {
|
||||||
pdfTitle = info["Title"];
|
pdfTitle = info.Title;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (pdfTitle) {
|
if (pdfTitle) {
|
||||||
|
20
gulpfile.js
20
gulpfile.js
@ -171,7 +171,7 @@ function createWebpackConfig(defines, output) {
|
|||||||
var bundleDefines = builder.merge(defines, {
|
var bundleDefines = builder.merge(defines, {
|
||||||
BUNDLE_VERSION: versionInfo.version,
|
BUNDLE_VERSION: versionInfo.version,
|
||||||
BUNDLE_BUILD: versionInfo.commit,
|
BUNDLE_BUILD: versionInfo.commit,
|
||||||
TESTING: defines.TESTING || process.env["TESTING"] === "true",
|
TESTING: defines.TESTING || process.env.TESTING === "true",
|
||||||
});
|
});
|
||||||
var licenseHeaderLibre = fs
|
var licenseHeaderLibre = fs
|
||||||
.readFileSync("./src/license_header_libre.js")
|
.readFileSync("./src/license_header_libre.js")
|
||||||
@ -414,9 +414,9 @@ function createTestSource(testsName, bot) {
|
|||||||
console.log();
|
console.log();
|
||||||
console.log("### Running " + testsName + " tests");
|
console.log("### Running " + testsName + " tests");
|
||||||
|
|
||||||
var PDF_TEST = process.env["PDF_TEST"] || "test_manifest.json";
|
var PDF_TEST = process.env.PDF_TEST || "test_manifest.json";
|
||||||
var PDF_BROWSERS =
|
var PDF_BROWSERS =
|
||||||
process.env["PDF_BROWSERS"] ||
|
process.env.PDF_BROWSERS ||
|
||||||
"resources/browser_manifests/browser_manifest.json";
|
"resources/browser_manifests/browser_manifest.json";
|
||||||
|
|
||||||
if (!checkFile("test/" + PDF_BROWSERS)) {
|
if (!checkFile("test/" + PDF_BROWSERS)) {
|
||||||
@ -467,7 +467,7 @@ function makeRef(done, bot) {
|
|||||||
console.log("### Creating reference images");
|
console.log("### Creating reference images");
|
||||||
|
|
||||||
var PDF_BROWSERS =
|
var PDF_BROWSERS =
|
||||||
process.env["PDF_BROWSERS"] ||
|
process.env.PDF_BROWSERS ||
|
||||||
"resources/browser_manifests/browser_manifest.json";
|
"resources/browser_manifests/browser_manifest.json";
|
||||||
|
|
||||||
if (!checkFile("test/" + PDF_BROWSERS)) {
|
if (!checkFile("test/" + PDF_BROWSERS)) {
|
||||||
@ -1201,7 +1201,7 @@ function buildLib(defines, dir) {
|
|||||||
var bundleDefines = builder.merge(defines, {
|
var bundleDefines = builder.merge(defines, {
|
||||||
BUNDLE_VERSION: versionInfo.version,
|
BUNDLE_VERSION: versionInfo.version,
|
||||||
BUNDLE_BUILD: versionInfo.commit,
|
BUNDLE_BUILD: versionInfo.commit,
|
||||||
TESTING: process.env["TESTING"] === "true",
|
TESTING: process.env.TESTING === "true",
|
||||||
});
|
});
|
||||||
var ctx = {
|
var ctx = {
|
||||||
rootPath: __dirname,
|
rootPath: __dirname,
|
||||||
@ -1287,7 +1287,7 @@ gulp.task(
|
|||||||
);
|
);
|
||||||
|
|
||||||
gulp.task("testing-pre", function (done) {
|
gulp.task("testing-pre", function (done) {
|
||||||
process.env["TESTING"] = "true";
|
process.env.TESTING = "true";
|
||||||
done();
|
done();
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -1353,7 +1353,7 @@ gulp.task("baseline", function (done) {
|
|||||||
console.log();
|
console.log();
|
||||||
console.log("### Creating baseline environment");
|
console.log("### Creating baseline environment");
|
||||||
|
|
||||||
var baselineCommit = process.env["BASELINE"];
|
var baselineCommit = process.env.BASELINE;
|
||||||
if (!baselineCommit) {
|
if (!baselineCommit) {
|
||||||
done(new Error("Missing baseline commit. Specify the BASELINE variable."));
|
done(new Error("Missing baseline commit. Specify the BASELINE variable."));
|
||||||
return;
|
return;
|
||||||
@ -1552,7 +1552,7 @@ gulp.task("wintersmith", function (done) {
|
|||||||
|
|
||||||
gulp.task("gh-pages-git", function (done) {
|
gulp.task("gh-pages-git", function (done) {
|
||||||
var VERSION = getVersionJSON().version;
|
var VERSION = getVersionJSON().version;
|
||||||
var reason = process.env["PDFJS_UPDATE_REASON"];
|
var reason = process.env.PDFJS_UPDATE_REASON;
|
||||||
|
|
||||||
safeSpawnSync("git", ["init"], { cwd: GH_PAGES_DIR });
|
safeSpawnSync("git", ["init"], { cwd: GH_PAGES_DIR });
|
||||||
safeSpawnSync("git", ["remote", "add", "origin", REPO], {
|
safeSpawnSync("git", ["remote", "add", "origin", REPO], {
|
||||||
@ -1720,7 +1720,7 @@ gulp.task(
|
|||||||
gulp.series("dist-pre", function (done) {
|
gulp.series("dist-pre", function (done) {
|
||||||
var distPath = DIST_DIR;
|
var distPath = DIST_DIR;
|
||||||
var opts = {};
|
var opts = {};
|
||||||
var installPath = process.env["PDFJS_INSTALL_PATH"];
|
var installPath = process.env.PDFJS_INSTALL_PATH;
|
||||||
if (installPath) {
|
if (installPath) {
|
||||||
opts.cwd = installPath;
|
opts.cwd = installPath;
|
||||||
distPath = path.relative(installPath, distPath);
|
distPath = path.relative(installPath, distPath);
|
||||||
@ -1738,7 +1738,7 @@ gulp.task(
|
|||||||
console.log();
|
console.log();
|
||||||
console.log("### Committing changes");
|
console.log("### Committing changes");
|
||||||
|
|
||||||
var reason = process.env["PDFJS_UPDATE_REASON"];
|
var reason = process.env.PDFJS_UPDATE_REASON;
|
||||||
// Attempt to work-around the broken link, see https://github.com/mozilla/pdf.js/issues/10391
|
// Attempt to work-around the broken link, see https://github.com/mozilla/pdf.js/issues/10391
|
||||||
if (typeof reason === "string") {
|
if (typeof reason === "string") {
|
||||||
var reasonParts = /^(See )(mozilla\/pdf\.js)@tags\/(v\d+\.\d+\.\d+)\s*$/.exec(
|
var reasonParts = /^(See )(mozilla\/pdf\.js)@tags\/(v\d+\.\d+\.\d+)\s*$/.exec(
|
||||||
|
@ -473,17 +473,17 @@ const CCITTFaxDecoder = (function CCITTFaxDecoder() {
|
|||||||
this.source = source;
|
this.source = source;
|
||||||
this.eof = false;
|
this.eof = false;
|
||||||
|
|
||||||
this.encoding = options["K"] || 0;
|
this.encoding = options.K || 0;
|
||||||
this.eoline = options["EndOfLine"] || false;
|
this.eoline = options.EndOfLine || false;
|
||||||
this.byteAlign = options["EncodedByteAlign"] || false;
|
this.byteAlign = options.EncodedByteAlign || false;
|
||||||
this.columns = options["Columns"] || 1728;
|
this.columns = options.Columns || 1728;
|
||||||
this.rows = options["Rows"] || 0;
|
this.rows = options.Rows || 0;
|
||||||
let eoblock = options["EndOfBlock"];
|
let eoblock = options.EndOfBlock;
|
||||||
if (eoblock === null || eoblock === undefined) {
|
if (eoblock === null || eoblock === undefined) {
|
||||||
eoblock = true;
|
eoblock = true;
|
||||||
}
|
}
|
||||||
this.eoblock = eoblock;
|
this.eoblock = eoblock;
|
||||||
this.black = options["BlackIs1"] || false;
|
this.black = options.BlackIs1 || false;
|
||||||
|
|
||||||
this.codingLine = new Uint32Array(this.columns + 1);
|
this.codingLine = new Uint32Array(this.columns + 1);
|
||||||
this.refLine = new Uint32Array(this.columns + 2);
|
this.refLine = new Uint32Array(this.columns + 2);
|
||||||
|
@ -725,10 +725,10 @@ class PDFDocument {
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!docInfo["Custom"]) {
|
if (!docInfo.Custom) {
|
||||||
docInfo["Custom"] = Object.create(null);
|
docInfo.Custom = Object.create(null);
|
||||||
}
|
}
|
||||||
docInfo["Custom"][key] = customValue;
|
docInfo.Custom[key] = customValue;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -3533,57 +3533,57 @@ var EvaluatorPreprocessor = (function EvaluatorPreprocessorClosure() {
|
|||||||
// If variableArgs === false: exactly `numArgs` expected
|
// If variableArgs === false: exactly `numArgs` expected
|
||||||
var getOPMap = getLookupTableFactory(function (t) {
|
var getOPMap = getLookupTableFactory(function (t) {
|
||||||
// Graphic state
|
// Graphic state
|
||||||
t["w"] = { id: OPS.setLineWidth, numArgs: 1, variableArgs: false };
|
t.w = { id: OPS.setLineWidth, numArgs: 1, variableArgs: false };
|
||||||
t["J"] = { id: OPS.setLineCap, numArgs: 1, variableArgs: false };
|
t.J = { id: OPS.setLineCap, numArgs: 1, variableArgs: false };
|
||||||
t["j"] = { id: OPS.setLineJoin, numArgs: 1, variableArgs: false };
|
t.j = { id: OPS.setLineJoin, numArgs: 1, variableArgs: false };
|
||||||
t["M"] = { id: OPS.setMiterLimit, numArgs: 1, variableArgs: false };
|
t.M = { id: OPS.setMiterLimit, numArgs: 1, variableArgs: false };
|
||||||
t["d"] = { id: OPS.setDash, numArgs: 2, variableArgs: false };
|
t.d = { id: OPS.setDash, numArgs: 2, variableArgs: false };
|
||||||
t["ri"] = { id: OPS.setRenderingIntent, numArgs: 1, variableArgs: false };
|
t.ri = { id: OPS.setRenderingIntent, numArgs: 1, variableArgs: false };
|
||||||
t["i"] = { id: OPS.setFlatness, numArgs: 1, variableArgs: false };
|
t.i = { id: OPS.setFlatness, numArgs: 1, variableArgs: false };
|
||||||
t["gs"] = { id: OPS.setGState, numArgs: 1, variableArgs: false };
|
t.gs = { id: OPS.setGState, numArgs: 1, variableArgs: false };
|
||||||
t["q"] = { id: OPS.save, numArgs: 0, variableArgs: false };
|
t.q = { id: OPS.save, numArgs: 0, variableArgs: false };
|
||||||
t["Q"] = { id: OPS.restore, numArgs: 0, variableArgs: false };
|
t.Q = { id: OPS.restore, numArgs: 0, variableArgs: false };
|
||||||
t["cm"] = { id: OPS.transform, numArgs: 6, variableArgs: false };
|
t.cm = { id: OPS.transform, numArgs: 6, variableArgs: false };
|
||||||
|
|
||||||
// Path
|
// Path
|
||||||
t["m"] = { id: OPS.moveTo, numArgs: 2, variableArgs: false };
|
t.m = { id: OPS.moveTo, numArgs: 2, variableArgs: false };
|
||||||
t["l"] = { id: OPS.lineTo, numArgs: 2, variableArgs: false };
|
t.l = { id: OPS.lineTo, numArgs: 2, variableArgs: false };
|
||||||
t["c"] = { id: OPS.curveTo, numArgs: 6, variableArgs: false };
|
t.c = { id: OPS.curveTo, numArgs: 6, variableArgs: false };
|
||||||
t["v"] = { id: OPS.curveTo2, numArgs: 4, variableArgs: false };
|
t.v = { id: OPS.curveTo2, numArgs: 4, variableArgs: false };
|
||||||
t["y"] = { id: OPS.curveTo3, numArgs: 4, variableArgs: false };
|
t.y = { id: OPS.curveTo3, numArgs: 4, variableArgs: false };
|
||||||
t["h"] = { id: OPS.closePath, numArgs: 0, variableArgs: false };
|
t.h = { id: OPS.closePath, numArgs: 0, variableArgs: false };
|
||||||
t["re"] = { id: OPS.rectangle, numArgs: 4, variableArgs: false };
|
t.re = { id: OPS.rectangle, numArgs: 4, variableArgs: false };
|
||||||
t["S"] = { id: OPS.stroke, numArgs: 0, variableArgs: false };
|
t.S = { id: OPS.stroke, numArgs: 0, variableArgs: false };
|
||||||
t["s"] = { id: OPS.closeStroke, numArgs: 0, variableArgs: false };
|
t.s = { id: OPS.closeStroke, numArgs: 0, variableArgs: false };
|
||||||
t["f"] = { id: OPS.fill, numArgs: 0, variableArgs: false };
|
t.f = { id: OPS.fill, numArgs: 0, variableArgs: false };
|
||||||
t["F"] = { id: OPS.fill, numArgs: 0, variableArgs: false };
|
t.F = { id: OPS.fill, numArgs: 0, variableArgs: false };
|
||||||
t["f*"] = { id: OPS.eoFill, numArgs: 0, variableArgs: false };
|
t["f*"] = { id: OPS.eoFill, numArgs: 0, variableArgs: false };
|
||||||
t["B"] = { id: OPS.fillStroke, numArgs: 0, variableArgs: false };
|
t.B = { id: OPS.fillStroke, numArgs: 0, variableArgs: false };
|
||||||
t["B*"] = { id: OPS.eoFillStroke, numArgs: 0, variableArgs: false };
|
t["B*"] = { id: OPS.eoFillStroke, numArgs: 0, variableArgs: false };
|
||||||
t["b"] = { id: OPS.closeFillStroke, numArgs: 0, variableArgs: false };
|
t.b = { id: OPS.closeFillStroke, numArgs: 0, variableArgs: false };
|
||||||
t["b*"] = { id: OPS.closeEOFillStroke, numArgs: 0, variableArgs: false };
|
t["b*"] = { id: OPS.closeEOFillStroke, numArgs: 0, variableArgs: false };
|
||||||
t["n"] = { id: OPS.endPath, numArgs: 0, variableArgs: false };
|
t.n = { id: OPS.endPath, numArgs: 0, variableArgs: false };
|
||||||
|
|
||||||
// Clipping
|
// Clipping
|
||||||
t["W"] = { id: OPS.clip, numArgs: 0, variableArgs: false };
|
t.W = { id: OPS.clip, numArgs: 0, variableArgs: false };
|
||||||
t["W*"] = { id: OPS.eoClip, numArgs: 0, variableArgs: false };
|
t["W*"] = { id: OPS.eoClip, numArgs: 0, variableArgs: false };
|
||||||
|
|
||||||
// Text
|
// Text
|
||||||
t["BT"] = { id: OPS.beginText, numArgs: 0, variableArgs: false };
|
t.BT = { id: OPS.beginText, numArgs: 0, variableArgs: false };
|
||||||
t["ET"] = { id: OPS.endText, numArgs: 0, variableArgs: false };
|
t.ET = { id: OPS.endText, numArgs: 0, variableArgs: false };
|
||||||
t["Tc"] = { id: OPS.setCharSpacing, numArgs: 1, variableArgs: false };
|
t.Tc = { id: OPS.setCharSpacing, numArgs: 1, variableArgs: false };
|
||||||
t["Tw"] = { id: OPS.setWordSpacing, numArgs: 1, variableArgs: false };
|
t.Tw = { id: OPS.setWordSpacing, numArgs: 1, variableArgs: false };
|
||||||
t["Tz"] = { id: OPS.setHScale, numArgs: 1, variableArgs: false };
|
t.Tz = { id: OPS.setHScale, numArgs: 1, variableArgs: false };
|
||||||
t["TL"] = { id: OPS.setLeading, numArgs: 1, variableArgs: false };
|
t.TL = { id: OPS.setLeading, numArgs: 1, variableArgs: false };
|
||||||
t["Tf"] = { id: OPS.setFont, numArgs: 2, variableArgs: false };
|
t.Tf = { id: OPS.setFont, numArgs: 2, variableArgs: false };
|
||||||
t["Tr"] = { id: OPS.setTextRenderingMode, numArgs: 1, variableArgs: false };
|
t.Tr = { id: OPS.setTextRenderingMode, numArgs: 1, variableArgs: false };
|
||||||
t["Ts"] = { id: OPS.setTextRise, numArgs: 1, variableArgs: false };
|
t.Ts = { id: OPS.setTextRise, numArgs: 1, variableArgs: false };
|
||||||
t["Td"] = { id: OPS.moveText, numArgs: 2, variableArgs: false };
|
t.Td = { id: OPS.moveText, numArgs: 2, variableArgs: false };
|
||||||
t["TD"] = { id: OPS.setLeadingMoveText, numArgs: 2, variableArgs: false };
|
t.TD = { id: OPS.setLeadingMoveText, numArgs: 2, variableArgs: false };
|
||||||
t["Tm"] = { id: OPS.setTextMatrix, numArgs: 6, variableArgs: false };
|
t.Tm = { id: OPS.setTextMatrix, numArgs: 6, variableArgs: false };
|
||||||
t["T*"] = { id: OPS.nextLine, numArgs: 0, variableArgs: false };
|
t["T*"] = { id: OPS.nextLine, numArgs: 0, variableArgs: false };
|
||||||
t["Tj"] = { id: OPS.showText, numArgs: 1, variableArgs: false };
|
t.Tj = { id: OPS.showText, numArgs: 1, variableArgs: false };
|
||||||
t["TJ"] = { id: OPS.showSpacedText, numArgs: 1, variableArgs: false };
|
t.TJ = { id: OPS.showSpacedText, numArgs: 1, variableArgs: false };
|
||||||
t["'"] = { id: OPS.nextLineShowText, numArgs: 1, variableArgs: false };
|
t["'"] = { id: OPS.nextLineShowText, numArgs: 1, variableArgs: false };
|
||||||
t['"'] = {
|
t['"'] = {
|
||||||
id: OPS.nextLineSetSpacingShowText,
|
id: OPS.nextLineSetSpacingShowText,
|
||||||
@ -3592,62 +3592,62 @@ var EvaluatorPreprocessor = (function EvaluatorPreprocessorClosure() {
|
|||||||
};
|
};
|
||||||
|
|
||||||
// Type3 fonts
|
// Type3 fonts
|
||||||
t["d0"] = { id: OPS.setCharWidth, numArgs: 2, variableArgs: false };
|
t.d0 = { id: OPS.setCharWidth, numArgs: 2, variableArgs: false };
|
||||||
t["d1"] = {
|
t.d1 = {
|
||||||
id: OPS.setCharWidthAndBounds,
|
id: OPS.setCharWidthAndBounds,
|
||||||
numArgs: 6,
|
numArgs: 6,
|
||||||
variableArgs: false,
|
variableArgs: false,
|
||||||
};
|
};
|
||||||
|
|
||||||
// Color
|
// Color
|
||||||
t["CS"] = { id: OPS.setStrokeColorSpace, numArgs: 1, variableArgs: false };
|
t.CS = { id: OPS.setStrokeColorSpace, numArgs: 1, variableArgs: false };
|
||||||
t["cs"] = { id: OPS.setFillColorSpace, numArgs: 1, variableArgs: false };
|
t.cs = { id: OPS.setFillColorSpace, numArgs: 1, variableArgs: false };
|
||||||
t["SC"] = { id: OPS.setStrokeColor, numArgs: 4, variableArgs: true };
|
t.SC = { id: OPS.setStrokeColor, numArgs: 4, variableArgs: true };
|
||||||
t["SCN"] = { id: OPS.setStrokeColorN, numArgs: 33, variableArgs: true };
|
t.SCN = { id: OPS.setStrokeColorN, numArgs: 33, variableArgs: true };
|
||||||
t["sc"] = { id: OPS.setFillColor, numArgs: 4, variableArgs: true };
|
t.sc = { id: OPS.setFillColor, numArgs: 4, variableArgs: true };
|
||||||
t["scn"] = { id: OPS.setFillColorN, numArgs: 33, variableArgs: true };
|
t.scn = { id: OPS.setFillColorN, numArgs: 33, variableArgs: true };
|
||||||
t["G"] = { id: OPS.setStrokeGray, numArgs: 1, variableArgs: false };
|
t.G = { id: OPS.setStrokeGray, numArgs: 1, variableArgs: false };
|
||||||
t["g"] = { id: OPS.setFillGray, numArgs: 1, variableArgs: false };
|
t.g = { id: OPS.setFillGray, numArgs: 1, variableArgs: false };
|
||||||
t["RG"] = { id: OPS.setStrokeRGBColor, numArgs: 3, variableArgs: false };
|
t.RG = { id: OPS.setStrokeRGBColor, numArgs: 3, variableArgs: false };
|
||||||
t["rg"] = { id: OPS.setFillRGBColor, numArgs: 3, variableArgs: false };
|
t.rg = { id: OPS.setFillRGBColor, numArgs: 3, variableArgs: false };
|
||||||
t["K"] = { id: OPS.setStrokeCMYKColor, numArgs: 4, variableArgs: false };
|
t.K = { id: OPS.setStrokeCMYKColor, numArgs: 4, variableArgs: false };
|
||||||
t["k"] = { id: OPS.setFillCMYKColor, numArgs: 4, variableArgs: false };
|
t.k = { id: OPS.setFillCMYKColor, numArgs: 4, variableArgs: false };
|
||||||
|
|
||||||
// Shading
|
// Shading
|
||||||
t["sh"] = { id: OPS.shadingFill, numArgs: 1, variableArgs: false };
|
t.sh = { id: OPS.shadingFill, numArgs: 1, variableArgs: false };
|
||||||
|
|
||||||
// Images
|
// Images
|
||||||
t["BI"] = { id: OPS.beginInlineImage, numArgs: 0, variableArgs: false };
|
t.BI = { id: OPS.beginInlineImage, numArgs: 0, variableArgs: false };
|
||||||
t["ID"] = { id: OPS.beginImageData, numArgs: 0, variableArgs: false };
|
t.ID = { id: OPS.beginImageData, numArgs: 0, variableArgs: false };
|
||||||
t["EI"] = { id: OPS.endInlineImage, numArgs: 1, variableArgs: false };
|
t.EI = { id: OPS.endInlineImage, numArgs: 1, variableArgs: false };
|
||||||
|
|
||||||
// XObjects
|
// XObjects
|
||||||
t["Do"] = { id: OPS.paintXObject, numArgs: 1, variableArgs: false };
|
t.Do = { id: OPS.paintXObject, numArgs: 1, variableArgs: false };
|
||||||
t["MP"] = { id: OPS.markPoint, numArgs: 1, variableArgs: false };
|
t.MP = { id: OPS.markPoint, numArgs: 1, variableArgs: false };
|
||||||
t["DP"] = { id: OPS.markPointProps, numArgs: 2, variableArgs: false };
|
t.DP = { id: OPS.markPointProps, numArgs: 2, variableArgs: false };
|
||||||
t["BMC"] = { id: OPS.beginMarkedContent, numArgs: 1, variableArgs: false };
|
t.BMC = { id: OPS.beginMarkedContent, numArgs: 1, variableArgs: false };
|
||||||
t["BDC"] = {
|
t.BDC = {
|
||||||
id: OPS.beginMarkedContentProps,
|
id: OPS.beginMarkedContentProps,
|
||||||
numArgs: 2,
|
numArgs: 2,
|
||||||
variableArgs: false,
|
variableArgs: false,
|
||||||
};
|
};
|
||||||
t["EMC"] = { id: OPS.endMarkedContent, numArgs: 0, variableArgs: false };
|
t.EMC = { id: OPS.endMarkedContent, numArgs: 0, variableArgs: false };
|
||||||
|
|
||||||
// Compatibility
|
// Compatibility
|
||||||
t["BX"] = { id: OPS.beginCompat, numArgs: 0, variableArgs: false };
|
t.BX = { id: OPS.beginCompat, numArgs: 0, variableArgs: false };
|
||||||
t["EX"] = { id: OPS.endCompat, numArgs: 0, variableArgs: false };
|
t.EX = { id: OPS.endCompat, numArgs: 0, variableArgs: false };
|
||||||
|
|
||||||
// (reserved partial commands for the lexer)
|
// (reserved partial commands for the lexer)
|
||||||
t["BM"] = null;
|
t.BM = null;
|
||||||
t["BD"] = null;
|
t.BD = null;
|
||||||
t["true"] = null;
|
t.true = null;
|
||||||
t["fa"] = null;
|
t.fa = null;
|
||||||
t["fal"] = null;
|
t.fal = null;
|
||||||
t["fals"] = null;
|
t.fals = null;
|
||||||
t["false"] = null;
|
t.false = null;
|
||||||
t["nu"] = null;
|
t.nu = null;
|
||||||
t["nul"] = null;
|
t.nul = null;
|
||||||
t["null"] = null;
|
t.null = null;
|
||||||
});
|
});
|
||||||
|
|
||||||
const MAX_INVALID_PATH_OPS = 20;
|
const MAX_INVALID_PATH_OPS = 20;
|
||||||
|
@ -1447,13 +1447,13 @@ var Font = (function FontClosure() {
|
|||||||
function readTables(file, numTables) {
|
function readTables(file, numTables) {
|
||||||
const tables = Object.create(null);
|
const tables = Object.create(null);
|
||||||
tables["OS/2"] = null;
|
tables["OS/2"] = null;
|
||||||
tables["cmap"] = null;
|
tables.cmap = null;
|
||||||
tables["head"] = null;
|
tables.head = null;
|
||||||
tables["hhea"] = null;
|
tables.hhea = null;
|
||||||
tables["hmtx"] = null;
|
tables.hmtx = null;
|
||||||
tables["maxp"] = null;
|
tables.maxp = null;
|
||||||
tables["name"] = null;
|
tables.name = null;
|
||||||
tables["post"] = null;
|
tables.post = null;
|
||||||
|
|
||||||
for (let i = 0; i < numTables; i++) {
|
for (let i = 0; i < numTables; i++) {
|
||||||
const table = readTableEntry(file);
|
const table = readTableEntry(file);
|
||||||
@ -1548,12 +1548,12 @@ var Font = (function FontClosure() {
|
|||||||
const potentialHeader = readOpenTypeHeader(ttc);
|
const potentialHeader = readOpenTypeHeader(ttc);
|
||||||
const potentialTables = readTables(ttc, potentialHeader.numTables);
|
const potentialTables = readTables(ttc, potentialHeader.numTables);
|
||||||
|
|
||||||
if (!potentialTables["name"]) {
|
if (!potentialTables.name) {
|
||||||
throw new FormatError(
|
throw new FormatError(
|
||||||
'TrueType Collection font must contain a "name" table.'
|
'TrueType Collection font must contain a "name" table.'
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
const nameTable = readNameTable(potentialTables["name"]);
|
const nameTable = readNameTable(potentialTables.name);
|
||||||
|
|
||||||
for (let j = 0, jj = nameTable.length; j < jj; j++) {
|
for (let j = 0, jj = nameTable.length; j < jj; j++) {
|
||||||
for (let k = 0, kk = nameTable[j].length; k < kk; k++) {
|
for (let k = 0, kk = nameTable[j].length; k < kk; k++) {
|
||||||
@ -2591,10 +2591,10 @@ var Font = (function FontClosure() {
|
|||||||
// OpenType font (skip composite fonts with non-default glyph mapping).
|
// OpenType font (skip composite fonts with non-default glyph mapping).
|
||||||
if (
|
if (
|
||||||
(header.version === "OTTO" && !isComposite) ||
|
(header.version === "OTTO" && !isComposite) ||
|
||||||
!tables["head"] ||
|
!tables.head ||
|
||||||
!tables["hhea"] ||
|
!tables.hhea ||
|
||||||
!tables["maxp"] ||
|
!tables.maxp ||
|
||||||
!tables["post"]
|
!tables.post
|
||||||
) {
|
) {
|
||||||
// No major tables: throwing everything at `CFFFont`.
|
// No major tables: throwing everything at `CFFFont`.
|
||||||
cffFile = new Stream(tables["CFF "].data);
|
cffFile = new Stream(tables["CFF "].data);
|
||||||
@ -2605,20 +2605,20 @@ var Font = (function FontClosure() {
|
|||||||
return this.convert(name, cff, properties);
|
return this.convert(name, cff, properties);
|
||||||
}
|
}
|
||||||
|
|
||||||
delete tables["glyf"];
|
delete tables.glyf;
|
||||||
delete tables["loca"];
|
delete tables.loca;
|
||||||
delete tables["fpgm"];
|
delete tables.fpgm;
|
||||||
delete tables["prep"];
|
delete tables.prep;
|
||||||
delete tables["cvt "];
|
delete tables["cvt "];
|
||||||
this.isOpenType = true;
|
this.isOpenType = true;
|
||||||
} else {
|
} else {
|
||||||
if (!tables["loca"]) {
|
if (!tables.loca) {
|
||||||
throw new FormatError('Required "loca" table is not found');
|
throw new FormatError('Required "loca" table is not found');
|
||||||
}
|
}
|
||||||
if (!tables["glyf"]) {
|
if (!tables.glyf) {
|
||||||
warn('Required "glyf" table is not found -- trying to recover.');
|
warn('Required "glyf" table is not found -- trying to recover.');
|
||||||
// Note: We use `sanitizeGlyphLocations` to add dummy glyf data below.
|
// Note: We use `sanitizeGlyphLocations` to add dummy glyf data below.
|
||||||
tables["glyf"] = {
|
tables.glyf = {
|
||||||
tag: "glyf",
|
tag: "glyf",
|
||||||
data: new Uint8Array(0),
|
data: new Uint8Array(0),
|
||||||
};
|
};
|
||||||
@ -2626,11 +2626,11 @@ var Font = (function FontClosure() {
|
|||||||
this.isOpenType = false;
|
this.isOpenType = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!tables["maxp"]) {
|
if (!tables.maxp) {
|
||||||
throw new FormatError('Required "maxp" table is not found');
|
throw new FormatError('Required "maxp" table is not found');
|
||||||
}
|
}
|
||||||
|
|
||||||
font.pos = (font.start || 0) + tables["maxp"].offset;
|
font.pos = (font.start || 0) + tables.maxp.offset;
|
||||||
var version = font.getInt32();
|
var version = font.getInt32();
|
||||||
const numGlyphs = font.getUint16();
|
const numGlyphs = font.getUint16();
|
||||||
// Glyph 0 is duplicated and appended.
|
// Glyph 0 is duplicated and appended.
|
||||||
@ -2643,14 +2643,14 @@ var Font = (function FontClosure() {
|
|||||||
}
|
}
|
||||||
var maxFunctionDefs = 0;
|
var maxFunctionDefs = 0;
|
||||||
var maxSizeOfInstructions = 0;
|
var maxSizeOfInstructions = 0;
|
||||||
if (version >= 0x00010000 && tables["maxp"].length >= 22) {
|
if (version >= 0x00010000 && tables.maxp.length >= 22) {
|
||||||
// maxZones can be invalid
|
// maxZones can be invalid
|
||||||
font.pos += 8;
|
font.pos += 8;
|
||||||
var maxZones = font.getUint16();
|
var maxZones = font.getUint16();
|
||||||
if (maxZones > 2) {
|
if (maxZones > 2) {
|
||||||
// reset to 2 if font has invalid maxZones
|
// reset to 2 if font has invalid maxZones
|
||||||
tables["maxp"].data[14] = 0;
|
tables.maxp.data[14] = 0;
|
||||||
tables["maxp"].data[15] = 2;
|
tables.maxp.data[15] = 2;
|
||||||
}
|
}
|
||||||
font.pos += 4;
|
font.pos += 4;
|
||||||
maxFunctionDefs = font.getUint16();
|
maxFunctionDefs = font.getUint16();
|
||||||
@ -2658,18 +2658,18 @@ var Font = (function FontClosure() {
|
|||||||
maxSizeOfInstructions = font.getUint16();
|
maxSizeOfInstructions = font.getUint16();
|
||||||
}
|
}
|
||||||
|
|
||||||
tables["maxp"].data[4] = numGlyphsOut >> 8;
|
tables.maxp.data[4] = numGlyphsOut >> 8;
|
||||||
tables["maxp"].data[5] = numGlyphsOut & 255;
|
tables.maxp.data[5] = numGlyphsOut & 255;
|
||||||
|
|
||||||
var hintsValid = sanitizeTTPrograms(
|
var hintsValid = sanitizeTTPrograms(
|
||||||
tables["fpgm"],
|
tables.fpgm,
|
||||||
tables["prep"],
|
tables.prep,
|
||||||
tables["cvt "],
|
tables["cvt "],
|
||||||
maxFunctionDefs
|
maxFunctionDefs
|
||||||
);
|
);
|
||||||
if (!hintsValid) {
|
if (!hintsValid) {
|
||||||
delete tables["fpgm"];
|
delete tables.fpgm;
|
||||||
delete tables["prep"];
|
delete tables.prep;
|
||||||
delete tables["cvt "];
|
delete tables["cvt "];
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2677,31 +2677,27 @@ var Font = (function FontClosure() {
|
|||||||
// sidebearings information for numGlyphs in the maxp table
|
// sidebearings information for numGlyphs in the maxp table
|
||||||
sanitizeMetrics(
|
sanitizeMetrics(
|
||||||
font,
|
font,
|
||||||
tables["hhea"],
|
tables.hhea,
|
||||||
tables["hmtx"],
|
tables.hmtx,
|
||||||
numGlyphsOut,
|
numGlyphsOut,
|
||||||
dupFirstEntry
|
dupFirstEntry
|
||||||
);
|
);
|
||||||
|
|
||||||
if (!tables["head"]) {
|
if (!tables.head) {
|
||||||
throw new FormatError('Required "head" table is not found');
|
throw new FormatError('Required "head" table is not found');
|
||||||
}
|
}
|
||||||
|
|
||||||
sanitizeHead(
|
sanitizeHead(tables.head, numGlyphs, isTrueType ? tables.loca.length : 0);
|
||||||
tables["head"],
|
|
||||||
numGlyphs,
|
|
||||||
isTrueType ? tables["loca"].length : 0
|
|
||||||
);
|
|
||||||
|
|
||||||
var missingGlyphs = Object.create(null);
|
var missingGlyphs = Object.create(null);
|
||||||
if (isTrueType) {
|
if (isTrueType) {
|
||||||
var isGlyphLocationsLong = int16(
|
var isGlyphLocationsLong = int16(
|
||||||
tables["head"].data[50],
|
tables.head.data[50],
|
||||||
tables["head"].data[51]
|
tables.head.data[51]
|
||||||
);
|
);
|
||||||
var glyphsInfo = sanitizeGlyphLocations(
|
var glyphsInfo = sanitizeGlyphLocations(
|
||||||
tables["loca"],
|
tables.loca,
|
||||||
tables["glyf"],
|
tables.glyf,
|
||||||
numGlyphs,
|
numGlyphs,
|
||||||
isGlyphLocationsLong,
|
isGlyphLocationsLong,
|
||||||
hintsValid,
|
hintsValid,
|
||||||
@ -2712,30 +2708,30 @@ var Font = (function FontClosure() {
|
|||||||
|
|
||||||
// Some fonts have incorrect maxSizeOfInstructions values, so we use
|
// Some fonts have incorrect maxSizeOfInstructions values, so we use
|
||||||
// the computed value instead.
|
// the computed value instead.
|
||||||
if (version >= 0x00010000 && tables["maxp"].length >= 22) {
|
if (version >= 0x00010000 && tables.maxp.length >= 22) {
|
||||||
tables["maxp"].data[26] = glyphsInfo.maxSizeOfInstructions >> 8;
|
tables.maxp.data[26] = glyphsInfo.maxSizeOfInstructions >> 8;
|
||||||
tables["maxp"].data[27] = glyphsInfo.maxSizeOfInstructions & 255;
|
tables.maxp.data[27] = glyphsInfo.maxSizeOfInstructions & 255;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (!tables["hhea"]) {
|
if (!tables.hhea) {
|
||||||
throw new FormatError('Required "hhea" table is not found');
|
throw new FormatError('Required "hhea" table is not found');
|
||||||
}
|
}
|
||||||
|
|
||||||
// Sanitizer reduces the glyph advanceWidth to the maxAdvanceWidth
|
// Sanitizer reduces the glyph advanceWidth to the maxAdvanceWidth
|
||||||
// Sometimes it's 0. That needs to be fixed
|
// Sometimes it's 0. That needs to be fixed
|
||||||
if (tables["hhea"].data[10] === 0 && tables["hhea"].data[11] === 0) {
|
if (tables.hhea.data[10] === 0 && tables.hhea.data[11] === 0) {
|
||||||
tables["hhea"].data[10] = 0xff;
|
tables.hhea.data[10] = 0xff;
|
||||||
tables["hhea"].data[11] = 0xff;
|
tables.hhea.data[11] = 0xff;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Extract some more font properties from the OpenType head and
|
// Extract some more font properties from the OpenType head and
|
||||||
// hhea tables; yMin and descent value are always negative.
|
// hhea tables; yMin and descent value are always negative.
|
||||||
var metricsOverride = {
|
var metricsOverride = {
|
||||||
unitsPerEm: int16(tables["head"].data[18], tables["head"].data[19]),
|
unitsPerEm: int16(tables.head.data[18], tables.head.data[19]),
|
||||||
yMax: int16(tables["head"].data[42], tables["head"].data[43]),
|
yMax: int16(tables.head.data[42], tables.head.data[43]),
|
||||||
yMin: signedInt16(tables["head"].data[38], tables["head"].data[39]),
|
yMin: signedInt16(tables.head.data[38], tables.head.data[39]),
|
||||||
ascent: int16(tables["hhea"].data[4], tables["hhea"].data[5]),
|
ascent: int16(tables.hhea.data[4], tables.hhea.data[5]),
|
||||||
descent: signedInt16(tables["hhea"].data[6], tables["hhea"].data[7]),
|
descent: signedInt16(tables.hhea.data[6], tables.hhea.data[7]),
|
||||||
};
|
};
|
||||||
|
|
||||||
// PDF FontDescriptor metrics lie -- using data from actual font.
|
// PDF FontDescriptor metrics lie -- using data from actual font.
|
||||||
@ -2743,12 +2739,12 @@ var Font = (function FontClosure() {
|
|||||||
this.descent = metricsOverride.descent / metricsOverride.unitsPerEm;
|
this.descent = metricsOverride.descent / metricsOverride.unitsPerEm;
|
||||||
|
|
||||||
// The 'post' table has glyphs names.
|
// The 'post' table has glyphs names.
|
||||||
if (tables["post"]) {
|
if (tables.post) {
|
||||||
readPostScriptTable(tables["post"], properties, numGlyphs);
|
readPostScriptTable(tables.post, properties, numGlyphs);
|
||||||
}
|
}
|
||||||
|
|
||||||
// The original 'post' table is not needed, replace it.
|
// The original 'post' table is not needed, replace it.
|
||||||
tables["post"] = {
|
tables.post = {
|
||||||
tag: "post",
|
tag: "post",
|
||||||
data: createPostTable(properties),
|
data: createPostTable(properties),
|
||||||
};
|
};
|
||||||
@ -2783,7 +2779,7 @@ var Font = (function FontClosure() {
|
|||||||
// Most of the following logic in this code branch is based on the
|
// Most of the following logic in this code branch is based on the
|
||||||
// 9.6.6.4 of the PDF spec.
|
// 9.6.6.4 of the PDF spec.
|
||||||
var cmapTable = readCmapTable(
|
var cmapTable = readCmapTable(
|
||||||
tables["cmap"],
|
tables.cmap,
|
||||||
font,
|
font,
|
||||||
this.isSymbolicFont,
|
this.isSymbolicFont,
|
||||||
properties.hasEncoding
|
properties.hasEncoding
|
||||||
@ -2916,7 +2912,7 @@ var Font = (function FontClosure() {
|
|||||||
// Converting glyphs and ids into font's cmap table
|
// Converting glyphs and ids into font's cmap table
|
||||||
var newMapping = adjustMapping(charCodeToGlyphId, hasGlyph, glyphZeroId);
|
var newMapping = adjustMapping(charCodeToGlyphId, hasGlyph, glyphZeroId);
|
||||||
this.toFontChar = newMapping.toFontChar;
|
this.toFontChar = newMapping.toFontChar;
|
||||||
tables["cmap"] = {
|
tables.cmap = {
|
||||||
tag: "cmap",
|
tag: "cmap",
|
||||||
data: createCmapTable(newMapping.charCodeToGlyphId, numGlyphsOut),
|
data: createCmapTable(newMapping.charCodeToGlyphId, numGlyphsOut),
|
||||||
};
|
};
|
||||||
@ -2951,15 +2947,15 @@ var Font = (function FontClosure() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Re-creating 'name' table
|
// Re-creating 'name' table
|
||||||
if (!tables["name"]) {
|
if (!tables.name) {
|
||||||
tables["name"] = {
|
tables.name = {
|
||||||
tag: "name",
|
tag: "name",
|
||||||
data: createNameTable(this.name),
|
data: createNameTable(this.name),
|
||||||
};
|
};
|
||||||
} else {
|
} else {
|
||||||
// ... using existing 'name' table as prototype
|
// ... using existing 'name' table as prototype
|
||||||
var namePrototype = readNameTable(tables["name"]);
|
var namePrototype = readNameTable(tables.name);
|
||||||
tables["name"].data = createNameTable(name, namePrototype);
|
tables.name.data = createNameTable(name, namePrototype);
|
||||||
}
|
}
|
||||||
|
|
||||||
var builder = new OpenTypeFileBuilder(header.version);
|
var builder = new OpenTypeFileBuilder(header.version);
|
||||||
|
File diff suppressed because it is too large
Load Diff
@ -1188,13 +1188,13 @@ var JpxImage = (function JpxImageClosure() {
|
|||||||
var codeblockIncluded = false;
|
var codeblockIncluded = false;
|
||||||
var firstTimeInclusion = false;
|
var firstTimeInclusion = false;
|
||||||
var valueReady;
|
var valueReady;
|
||||||
if (codeblock["included"] !== undefined) {
|
if (codeblock.included !== undefined) {
|
||||||
codeblockIncluded = !!readBits(1);
|
codeblockIncluded = !!readBits(1);
|
||||||
} else {
|
} else {
|
||||||
// reading inclusion tree
|
// reading inclusion tree
|
||||||
precinct = codeblock.precinct;
|
precinct = codeblock.precinct;
|
||||||
var inclusionTree, zeroBitPlanesTree;
|
var inclusionTree, zeroBitPlanesTree;
|
||||||
if (precinct["inclusionTree"] !== undefined) {
|
if (precinct.inclusionTree !== undefined) {
|
||||||
inclusionTree = precinct.inclusionTree;
|
inclusionTree = precinct.inclusionTree;
|
||||||
} else {
|
} else {
|
||||||
// building inclusion and zero bit-planes trees
|
// building inclusion and zero bit-planes trees
|
||||||
@ -1264,7 +1264,7 @@ var JpxImage = (function JpxImageClosure() {
|
|||||||
while (queue.length > 0) {
|
while (queue.length > 0) {
|
||||||
var packetItem = queue.shift();
|
var packetItem = queue.shift();
|
||||||
codeblock = packetItem.codeblock;
|
codeblock = packetItem.codeblock;
|
||||||
if (codeblock["data"] === undefined) {
|
if (codeblock.data === undefined) {
|
||||||
codeblock.data = [];
|
codeblock.data = [];
|
||||||
}
|
}
|
||||||
codeblock.data.push({
|
codeblock.data.push({
|
||||||
@ -1302,7 +1302,7 @@ var JpxImage = (function JpxImageClosure() {
|
|||||||
if (blockWidth === 0 || blockHeight === 0) {
|
if (blockWidth === 0 || blockHeight === 0) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if (codeblock["data"] === undefined) {
|
if (codeblock.data === undefined) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
5832
src/core/metrics.js
5832
src/core/metrics.js
File diff suppressed because it is too large
Load Diff
@ -21,11 +21,11 @@ import { getLookupTableFactory } from "./core_utils.js";
|
|||||||
* fonts and their acronyms.
|
* fonts and their acronyms.
|
||||||
*/
|
*/
|
||||||
const getStdFontMap = getLookupTableFactory(function (t) {
|
const getStdFontMap = getLookupTableFactory(function (t) {
|
||||||
t["ArialNarrow"] = "Helvetica";
|
t.ArialNarrow = "Helvetica";
|
||||||
t["ArialNarrow-Bold"] = "Helvetica-Bold";
|
t["ArialNarrow-Bold"] = "Helvetica-Bold";
|
||||||
t["ArialNarrow-BoldItalic"] = "Helvetica-BoldOblique";
|
t["ArialNarrow-BoldItalic"] = "Helvetica-BoldOblique";
|
||||||
t["ArialNarrow-Italic"] = "Helvetica-Oblique";
|
t["ArialNarrow-Italic"] = "Helvetica-Oblique";
|
||||||
t["ArialBlack"] = "Helvetica";
|
t.ArialBlack = "Helvetica";
|
||||||
t["ArialBlack-Bold"] = "Helvetica-Bold";
|
t["ArialBlack-Bold"] = "Helvetica-Bold";
|
||||||
t["ArialBlack-BoldItalic"] = "Helvetica-BoldOblique";
|
t["ArialBlack-BoldItalic"] = "Helvetica-BoldOblique";
|
||||||
t["ArialBlack-Italic"] = "Helvetica-Oblique";
|
t["ArialBlack-Italic"] = "Helvetica-Oblique";
|
||||||
@ -33,26 +33,26 @@ const getStdFontMap = getLookupTableFactory(function (t) {
|
|||||||
t["Arial-Black-Bold"] = "Helvetica-Bold";
|
t["Arial-Black-Bold"] = "Helvetica-Bold";
|
||||||
t["Arial-Black-BoldItalic"] = "Helvetica-BoldOblique";
|
t["Arial-Black-BoldItalic"] = "Helvetica-BoldOblique";
|
||||||
t["Arial-Black-Italic"] = "Helvetica-Oblique";
|
t["Arial-Black-Italic"] = "Helvetica-Oblique";
|
||||||
t["Arial"] = "Helvetica";
|
t.Arial = "Helvetica";
|
||||||
t["Arial-Bold"] = "Helvetica-Bold";
|
t["Arial-Bold"] = "Helvetica-Bold";
|
||||||
t["Arial-BoldItalic"] = "Helvetica-BoldOblique";
|
t["Arial-BoldItalic"] = "Helvetica-BoldOblique";
|
||||||
t["Arial-Italic"] = "Helvetica-Oblique";
|
t["Arial-Italic"] = "Helvetica-Oblique";
|
||||||
t["Arial-BoldItalicMT"] = "Helvetica-BoldOblique";
|
t["Arial-BoldItalicMT"] = "Helvetica-BoldOblique";
|
||||||
t["Arial-BoldMT"] = "Helvetica-Bold";
|
t["Arial-BoldMT"] = "Helvetica-Bold";
|
||||||
t["Arial-ItalicMT"] = "Helvetica-Oblique";
|
t["Arial-ItalicMT"] = "Helvetica-Oblique";
|
||||||
t["ArialMT"] = "Helvetica";
|
t.ArialMT = "Helvetica";
|
||||||
t["Courier-Bold"] = "Courier-Bold";
|
t["Courier-Bold"] = "Courier-Bold";
|
||||||
t["Courier-BoldItalic"] = "Courier-BoldOblique";
|
t["Courier-BoldItalic"] = "Courier-BoldOblique";
|
||||||
t["Courier-Italic"] = "Courier-Oblique";
|
t["Courier-Italic"] = "Courier-Oblique";
|
||||||
t["CourierNew"] = "Courier";
|
t.CourierNew = "Courier";
|
||||||
t["CourierNew-Bold"] = "Courier-Bold";
|
t["CourierNew-Bold"] = "Courier-Bold";
|
||||||
t["CourierNew-BoldItalic"] = "Courier-BoldOblique";
|
t["CourierNew-BoldItalic"] = "Courier-BoldOblique";
|
||||||
t["CourierNew-Italic"] = "Courier-Oblique";
|
t["CourierNew-Italic"] = "Courier-Oblique";
|
||||||
t["CourierNewPS-BoldItalicMT"] = "Courier-BoldOblique";
|
t["CourierNewPS-BoldItalicMT"] = "Courier-BoldOblique";
|
||||||
t["CourierNewPS-BoldMT"] = "Courier-Bold";
|
t["CourierNewPS-BoldMT"] = "Courier-Bold";
|
||||||
t["CourierNewPS-ItalicMT"] = "Courier-Oblique";
|
t["CourierNewPS-ItalicMT"] = "Courier-Oblique";
|
||||||
t["CourierNewPSMT"] = "Courier";
|
t.CourierNewPSMT = "Courier";
|
||||||
t["Helvetica"] = "Helvetica";
|
t.Helvetica = "Helvetica";
|
||||||
t["Helvetica-Bold"] = "Helvetica-Bold";
|
t["Helvetica-Bold"] = "Helvetica-Bold";
|
||||||
t["Helvetica-BoldItalic"] = "Helvetica-BoldOblique";
|
t["Helvetica-BoldItalic"] = "Helvetica-BoldOblique";
|
||||||
t["Helvetica-BoldOblique"] = "Helvetica-BoldOblique";
|
t["Helvetica-BoldOblique"] = "Helvetica-BoldOblique";
|
||||||
@ -61,18 +61,18 @@ const getStdFontMap = getLookupTableFactory(function (t) {
|
|||||||
t["Symbol-Bold"] = "Symbol";
|
t["Symbol-Bold"] = "Symbol";
|
||||||
t["Symbol-BoldItalic"] = "Symbol";
|
t["Symbol-BoldItalic"] = "Symbol";
|
||||||
t["Symbol-Italic"] = "Symbol";
|
t["Symbol-Italic"] = "Symbol";
|
||||||
t["TimesNewRoman"] = "Times-Roman";
|
t.TimesNewRoman = "Times-Roman";
|
||||||
t["TimesNewRoman-Bold"] = "Times-Bold";
|
t["TimesNewRoman-Bold"] = "Times-Bold";
|
||||||
t["TimesNewRoman-BoldItalic"] = "Times-BoldItalic";
|
t["TimesNewRoman-BoldItalic"] = "Times-BoldItalic";
|
||||||
t["TimesNewRoman-Italic"] = "Times-Italic";
|
t["TimesNewRoman-Italic"] = "Times-Italic";
|
||||||
t["TimesNewRomanPS"] = "Times-Roman";
|
t.TimesNewRomanPS = "Times-Roman";
|
||||||
t["TimesNewRomanPS-Bold"] = "Times-Bold";
|
t["TimesNewRomanPS-Bold"] = "Times-Bold";
|
||||||
t["TimesNewRomanPS-BoldItalic"] = "Times-BoldItalic";
|
t["TimesNewRomanPS-BoldItalic"] = "Times-BoldItalic";
|
||||||
t["TimesNewRomanPS-BoldItalicMT"] = "Times-BoldItalic";
|
t["TimesNewRomanPS-BoldItalicMT"] = "Times-BoldItalic";
|
||||||
t["TimesNewRomanPS-BoldMT"] = "Times-Bold";
|
t["TimesNewRomanPS-BoldMT"] = "Times-Bold";
|
||||||
t["TimesNewRomanPS-Italic"] = "Times-Italic";
|
t["TimesNewRomanPS-Italic"] = "Times-Italic";
|
||||||
t["TimesNewRomanPS-ItalicMT"] = "Times-Italic";
|
t["TimesNewRomanPS-ItalicMT"] = "Times-Italic";
|
||||||
t["TimesNewRomanPSMT"] = "Times-Roman";
|
t.TimesNewRomanPSMT = "Times-Roman";
|
||||||
t["TimesNewRomanPSMT-Bold"] = "Times-Bold";
|
t["TimesNewRomanPSMT-Bold"] = "Times-Bold";
|
||||||
t["TimesNewRomanPSMT-BoldItalic"] = "Times-BoldItalic";
|
t["TimesNewRomanPSMT-BoldItalic"] = "Times-BoldItalic";
|
||||||
t["TimesNewRomanPSMT-Italic"] = "Times-Italic";
|
t["TimesNewRomanPSMT-Italic"] = "Times-Italic";
|
||||||
@ -83,19 +83,19 @@ const getStdFontMap = getLookupTableFactory(function (t) {
|
|||||||
* a standard fonts without glyph data.
|
* a standard fonts without glyph data.
|
||||||
*/
|
*/
|
||||||
const getNonStdFontMap = getLookupTableFactory(function (t) {
|
const getNonStdFontMap = getLookupTableFactory(function (t) {
|
||||||
t["Calibri"] = "Helvetica";
|
t.Calibri = "Helvetica";
|
||||||
t["Calibri-Bold"] = "Helvetica-Bold";
|
t["Calibri-Bold"] = "Helvetica-Bold";
|
||||||
t["Calibri-BoldItalic"] = "Helvetica-BoldOblique";
|
t["Calibri-BoldItalic"] = "Helvetica-BoldOblique";
|
||||||
t["Calibri-Italic"] = "Helvetica-Oblique";
|
t["Calibri-Italic"] = "Helvetica-Oblique";
|
||||||
t["CenturyGothic"] = "Helvetica";
|
t.CenturyGothic = "Helvetica";
|
||||||
t["CenturyGothic-Bold"] = "Helvetica-Bold";
|
t["CenturyGothic-Bold"] = "Helvetica-Bold";
|
||||||
t["CenturyGothic-BoldItalic"] = "Helvetica-BoldOblique";
|
t["CenturyGothic-BoldItalic"] = "Helvetica-BoldOblique";
|
||||||
t["CenturyGothic-Italic"] = "Helvetica-Oblique";
|
t["CenturyGothic-Italic"] = "Helvetica-Oblique";
|
||||||
t["ComicSansMS"] = "Comic Sans MS";
|
t.ComicSansMS = "Comic Sans MS";
|
||||||
t["ComicSansMS-Bold"] = "Comic Sans MS-Bold";
|
t["ComicSansMS-Bold"] = "Comic Sans MS-Bold";
|
||||||
t["ComicSansMS-BoldItalic"] = "Comic Sans MS-BoldItalic";
|
t["ComicSansMS-BoldItalic"] = "Comic Sans MS-BoldItalic";
|
||||||
t["ComicSansMS-Italic"] = "Comic Sans MS-Italic";
|
t["ComicSansMS-Italic"] = "Comic Sans MS-Italic";
|
||||||
t["LucidaConsole"] = "Courier";
|
t.LucidaConsole = "Courier";
|
||||||
t["LucidaConsole-Bold"] = "Courier-Bold";
|
t["LucidaConsole-Bold"] = "Courier-Bold";
|
||||||
t["LucidaConsole-BoldItalic"] = "Courier-BoldOblique";
|
t["LucidaConsole-BoldItalic"] = "Courier-BoldOblique";
|
||||||
t["LucidaConsole-Italic"] = "Courier-Oblique";
|
t["LucidaConsole-Italic"] = "Courier-Oblique";
|
||||||
@ -116,103 +116,103 @@ const getNonStdFontMap = getLookupTableFactory(function (t) {
|
|||||||
t["MS-PMincho-Bold"] = "MS PMincho-Bold";
|
t["MS-PMincho-Bold"] = "MS PMincho-Bold";
|
||||||
t["MS-PMincho-BoldItalic"] = "MS PMincho-BoldItalic";
|
t["MS-PMincho-BoldItalic"] = "MS PMincho-BoldItalic";
|
||||||
t["MS-PMincho-Italic"] = "MS PMincho-Italic";
|
t["MS-PMincho-Italic"] = "MS PMincho-Italic";
|
||||||
t["NuptialScript"] = "Times-Italic";
|
t.NuptialScript = "Times-Italic";
|
||||||
t["SegoeUISymbol"] = "Helvetica";
|
t.SegoeUISymbol = "Helvetica";
|
||||||
t["Wingdings"] = "ZapfDingbats";
|
t.Wingdings = "ZapfDingbats";
|
||||||
t["Wingdings-Regular"] = "ZapfDingbats";
|
t["Wingdings-Regular"] = "ZapfDingbats";
|
||||||
});
|
});
|
||||||
|
|
||||||
const getSerifFonts = getLookupTableFactory(function (t) {
|
const getSerifFonts = getLookupTableFactory(function (t) {
|
||||||
t["Adobe Jenson"] = true;
|
t["Adobe Jenson"] = true;
|
||||||
t["Adobe Text"] = true;
|
t["Adobe Text"] = true;
|
||||||
t["Albertus"] = true;
|
t.Albertus = true;
|
||||||
t["Aldus"] = true;
|
t.Aldus = true;
|
||||||
t["Alexandria"] = true;
|
t.Alexandria = true;
|
||||||
t["Algerian"] = true;
|
t.Algerian = true;
|
||||||
t["American Typewriter"] = true;
|
t["American Typewriter"] = true;
|
||||||
t["Antiqua"] = true;
|
t.Antiqua = true;
|
||||||
t["Apex"] = true;
|
t.Apex = true;
|
||||||
t["Arno"] = true;
|
t.Arno = true;
|
||||||
t["Aster"] = true;
|
t.Aster = true;
|
||||||
t["Aurora"] = true;
|
t.Aurora = true;
|
||||||
t["Baskerville"] = true;
|
t.Baskerville = true;
|
||||||
t["Bell"] = true;
|
t.Bell = true;
|
||||||
t["Bembo"] = true;
|
t.Bembo = true;
|
||||||
t["Bembo Schoolbook"] = true;
|
t["Bembo Schoolbook"] = true;
|
||||||
t["Benguiat"] = true;
|
t.Benguiat = true;
|
||||||
t["Berkeley Old Style"] = true;
|
t["Berkeley Old Style"] = true;
|
||||||
t["Bernhard Modern"] = true;
|
t["Bernhard Modern"] = true;
|
||||||
t["Berthold City"] = true;
|
t["Berthold City"] = true;
|
||||||
t["Bodoni"] = true;
|
t.Bodoni = true;
|
||||||
t["Bauer Bodoni"] = true;
|
t["Bauer Bodoni"] = true;
|
||||||
t["Book Antiqua"] = true;
|
t["Book Antiqua"] = true;
|
||||||
t["Bookman"] = true;
|
t.Bookman = true;
|
||||||
t["Bordeaux Roman"] = true;
|
t["Bordeaux Roman"] = true;
|
||||||
t["Californian FB"] = true;
|
t["Californian FB"] = true;
|
||||||
t["Calisto"] = true;
|
t.Calisto = true;
|
||||||
t["Calvert"] = true;
|
t.Calvert = true;
|
||||||
t["Capitals"] = true;
|
t.Capitals = true;
|
||||||
t["Cambria"] = true;
|
t.Cambria = true;
|
||||||
t["Cartier"] = true;
|
t.Cartier = true;
|
||||||
t["Caslon"] = true;
|
t.Caslon = true;
|
||||||
t["Catull"] = true;
|
t.Catull = true;
|
||||||
t["Centaur"] = true;
|
t.Centaur = true;
|
||||||
t["Century Old Style"] = true;
|
t["Century Old Style"] = true;
|
||||||
t["Century Schoolbook"] = true;
|
t["Century Schoolbook"] = true;
|
||||||
t["Chaparral"] = true;
|
t.Chaparral = true;
|
||||||
t["Charis SIL"] = true;
|
t["Charis SIL"] = true;
|
||||||
t["Cheltenham"] = true;
|
t.Cheltenham = true;
|
||||||
t["Cholla Slab"] = true;
|
t["Cholla Slab"] = true;
|
||||||
t["Clarendon"] = true;
|
t.Clarendon = true;
|
||||||
t["Clearface"] = true;
|
t.Clearface = true;
|
||||||
t["Cochin"] = true;
|
t.Cochin = true;
|
||||||
t["Colonna"] = true;
|
t.Colonna = true;
|
||||||
t["Computer Modern"] = true;
|
t["Computer Modern"] = true;
|
||||||
t["Concrete Roman"] = true;
|
t["Concrete Roman"] = true;
|
||||||
t["Constantia"] = true;
|
t.Constantia = true;
|
||||||
t["Cooper Black"] = true;
|
t["Cooper Black"] = true;
|
||||||
t["Corona"] = true;
|
t.Corona = true;
|
||||||
t["Ecotype"] = true;
|
t.Ecotype = true;
|
||||||
t["Egyptienne"] = true;
|
t.Egyptienne = true;
|
||||||
t["Elephant"] = true;
|
t.Elephant = true;
|
||||||
t["Excelsior"] = true;
|
t.Excelsior = true;
|
||||||
t["Fairfield"] = true;
|
t.Fairfield = true;
|
||||||
t["FF Scala"] = true;
|
t["FF Scala"] = true;
|
||||||
t["Folkard"] = true;
|
t.Folkard = true;
|
||||||
t["Footlight"] = true;
|
t.Footlight = true;
|
||||||
t["FreeSerif"] = true;
|
t.FreeSerif = true;
|
||||||
t["Friz Quadrata"] = true;
|
t["Friz Quadrata"] = true;
|
||||||
t["Garamond"] = true;
|
t.Garamond = true;
|
||||||
t["Gentium"] = true;
|
t.Gentium = true;
|
||||||
t["Georgia"] = true;
|
t.Georgia = true;
|
||||||
t["Gloucester"] = true;
|
t.Gloucester = true;
|
||||||
t["Goudy Old Style"] = true;
|
t["Goudy Old Style"] = true;
|
||||||
t["Goudy Schoolbook"] = true;
|
t["Goudy Schoolbook"] = true;
|
||||||
t["Goudy Pro Font"] = true;
|
t["Goudy Pro Font"] = true;
|
||||||
t["Granjon"] = true;
|
t.Granjon = true;
|
||||||
t["Guardian Egyptian"] = true;
|
t["Guardian Egyptian"] = true;
|
||||||
t["Heather"] = true;
|
t.Heather = true;
|
||||||
t["Hercules"] = true;
|
t.Hercules = true;
|
||||||
t["High Tower Text"] = true;
|
t["High Tower Text"] = true;
|
||||||
t["Hiroshige"] = true;
|
t.Hiroshige = true;
|
||||||
t["Hoefler Text"] = true;
|
t["Hoefler Text"] = true;
|
||||||
t["Humana Serif"] = true;
|
t["Humana Serif"] = true;
|
||||||
t["Imprint"] = true;
|
t.Imprint = true;
|
||||||
t["Ionic No. 5"] = true;
|
t["Ionic No. 5"] = true;
|
||||||
t["Janson"] = true;
|
t.Janson = true;
|
||||||
t["Joanna"] = true;
|
t.Joanna = true;
|
||||||
t["Korinna"] = true;
|
t.Korinna = true;
|
||||||
t["Lexicon"] = true;
|
t.Lexicon = true;
|
||||||
t["Liberation Serif"] = true;
|
t["Liberation Serif"] = true;
|
||||||
t["Linux Libertine"] = true;
|
t["Linux Libertine"] = true;
|
||||||
t["Literaturnaya"] = true;
|
t.Literaturnaya = true;
|
||||||
t["Lucida"] = true;
|
t.Lucida = true;
|
||||||
t["Lucida Bright"] = true;
|
t["Lucida Bright"] = true;
|
||||||
t["Melior"] = true;
|
t.Melior = true;
|
||||||
t["Memphis"] = true;
|
t.Memphis = true;
|
||||||
t["Miller"] = true;
|
t.Miller = true;
|
||||||
t["Minion"] = true;
|
t.Minion = true;
|
||||||
t["Modern"] = true;
|
t.Modern = true;
|
||||||
t["Mona Lisa"] = true;
|
t["Mona Lisa"] = true;
|
||||||
t["Mrs Eaves"] = true;
|
t["Mrs Eaves"] = true;
|
||||||
t["MS Serif"] = true;
|
t["MS Serif"] = true;
|
||||||
@ -220,48 +220,48 @@ const getSerifFonts = getLookupTableFactory(function (t) {
|
|||||||
t["New York"] = true;
|
t["New York"] = true;
|
||||||
t["Nimbus Roman"] = true;
|
t["Nimbus Roman"] = true;
|
||||||
t["NPS Rawlinson Roadway"] = true;
|
t["NPS Rawlinson Roadway"] = true;
|
||||||
t["NuptialScript"] = true;
|
t.NuptialScript = true;
|
||||||
t["Palatino"] = true;
|
t.Palatino = true;
|
||||||
t["Perpetua"] = true;
|
t.Perpetua = true;
|
||||||
t["Plantin"] = true;
|
t.Plantin = true;
|
||||||
t["Plantin Schoolbook"] = true;
|
t["Plantin Schoolbook"] = true;
|
||||||
t["Playbill"] = true;
|
t.Playbill = true;
|
||||||
t["Poor Richard"] = true;
|
t["Poor Richard"] = true;
|
||||||
t["Rawlinson Roadway"] = true;
|
t["Rawlinson Roadway"] = true;
|
||||||
t["Renault"] = true;
|
t.Renault = true;
|
||||||
t["Requiem"] = true;
|
t.Requiem = true;
|
||||||
t["Rockwell"] = true;
|
t.Rockwell = true;
|
||||||
t["Roman"] = true;
|
t.Roman = true;
|
||||||
t["Rotis Serif"] = true;
|
t["Rotis Serif"] = true;
|
||||||
t["Sabon"] = true;
|
t.Sabon = true;
|
||||||
t["Scala"] = true;
|
t.Scala = true;
|
||||||
t["Seagull"] = true;
|
t.Seagull = true;
|
||||||
t["Sistina"] = true;
|
t.Sistina = true;
|
||||||
t["Souvenir"] = true;
|
t.Souvenir = true;
|
||||||
t["STIX"] = true;
|
t.STIX = true;
|
||||||
t["Stone Informal"] = true;
|
t["Stone Informal"] = true;
|
||||||
t["Stone Serif"] = true;
|
t["Stone Serif"] = true;
|
||||||
t["Sylfaen"] = true;
|
t.Sylfaen = true;
|
||||||
t["Times"] = true;
|
t.Times = true;
|
||||||
t["Trajan"] = true;
|
t.Trajan = true;
|
||||||
t["Trinité"] = true;
|
t["Trinité"] = true;
|
||||||
t["Trump Mediaeval"] = true;
|
t["Trump Mediaeval"] = true;
|
||||||
t["Utopia"] = true;
|
t.Utopia = true;
|
||||||
t["Vale Type"] = true;
|
t["Vale Type"] = true;
|
||||||
t["Bitstream Vera"] = true;
|
t["Bitstream Vera"] = true;
|
||||||
t["Vera Serif"] = true;
|
t["Vera Serif"] = true;
|
||||||
t["Versailles"] = true;
|
t.Versailles = true;
|
||||||
t["Wanted"] = true;
|
t.Wanted = true;
|
||||||
t["Weiss"] = true;
|
t.Weiss = true;
|
||||||
t["Wide Latin"] = true;
|
t["Wide Latin"] = true;
|
||||||
t["Windsor"] = true;
|
t.Windsor = true;
|
||||||
t["XITS"] = true;
|
t.XITS = true;
|
||||||
});
|
});
|
||||||
|
|
||||||
const getSymbolsFonts = getLookupTableFactory(function (t) {
|
const getSymbolsFonts = getLookupTableFactory(function (t) {
|
||||||
t["Dingbats"] = true;
|
t.Dingbats = true;
|
||||||
t["Symbol"] = true;
|
t.Symbol = true;
|
||||||
t["ZapfDingbats"] = true;
|
t.ZapfDingbats = true;
|
||||||
});
|
});
|
||||||
|
|
||||||
// Glyph map for well-known standard fonts. Sometimes Ghostscript uses CID
|
// Glyph map for well-known standard fonts. Sometimes Ghostscript uses CID
|
||||||
|
@ -566,7 +566,7 @@ var Type1Parser = (function Type1ParserClosure() {
|
|||||||
var subrs = [],
|
var subrs = [],
|
||||||
charstrings = [];
|
charstrings = [];
|
||||||
var privateData = Object.create(null);
|
var privateData = Object.create(null);
|
||||||
privateData["lenIV"] = 4;
|
privateData.lenIV = 4;
|
||||||
var program = {
|
var program = {
|
||||||
subrs: [],
|
subrs: [],
|
||||||
charstrings: [],
|
charstrings: [],
|
||||||
@ -601,7 +601,7 @@ var Type1Parser = (function Type1ParserClosure() {
|
|||||||
length = this.readInt();
|
length = this.readInt();
|
||||||
this.getToken(); // read in 'RD' or '-|'
|
this.getToken(); // read in 'RD' or '-|'
|
||||||
data = length > 0 ? stream.getBytes(length) : new Uint8Array(0);
|
data = length > 0 ? stream.getBytes(length) : new Uint8Array(0);
|
||||||
lenIV = program.properties.privateData["lenIV"];
|
lenIV = program.properties.privateData.lenIV;
|
||||||
encoded = this.readCharStrings(data, lenIV);
|
encoded = this.readCharStrings(data, lenIV);
|
||||||
this.nextChar();
|
this.nextChar();
|
||||||
token = this.getToken(); // read in 'ND' or '|-'
|
token = this.getToken(); // read in 'ND' or '|-'
|
||||||
@ -622,7 +622,7 @@ var Type1Parser = (function Type1ParserClosure() {
|
|||||||
length = this.readInt();
|
length = this.readInt();
|
||||||
this.getToken(); // read in 'RD' or '-|'
|
this.getToken(); // read in 'RD' or '-|'
|
||||||
data = length > 0 ? stream.getBytes(length) : new Uint8Array(0);
|
data = length > 0 ? stream.getBytes(length) : new Uint8Array(0);
|
||||||
lenIV = program.properties.privateData["lenIV"];
|
lenIV = program.properties.privateData.lenIV;
|
||||||
encoded = this.readCharStrings(data, lenIV);
|
encoded = this.readCharStrings(data, lenIV);
|
||||||
this.nextChar();
|
this.nextChar();
|
||||||
token = this.getToken(); // read in 'NP' or '|'
|
token = this.getToken(); // read in 'NP' or '|'
|
||||||
|
@ -376,7 +376,7 @@ class PDFNodeStreamRangeReader extends BaseRangeReader {
|
|||||||
}
|
}
|
||||||
this._httpHeaders[property] = value;
|
this._httpHeaders[property] = value;
|
||||||
}
|
}
|
||||||
this._httpHeaders["Range"] = `bytes=${start}-${end - 1}`;
|
this._httpHeaders.Range = `bytes=${start}-${end - 1}`;
|
||||||
|
|
||||||
const handleResponse = response => {
|
const handleResponse = response => {
|
||||||
if (response.statusCode === 404) {
|
if (response.statusCode === 404) {
|
||||||
|
@ -20,7 +20,7 @@
|
|||||||
const isNodeJS =
|
const isNodeJS =
|
||||||
typeof process === "object" &&
|
typeof process === "object" &&
|
||||||
process + "" === "[object process]" &&
|
process + "" === "[object process]" &&
|
||||||
!process.versions["nw"] &&
|
!process.versions.nw &&
|
||||||
!process.versions["electron"];
|
!process.versions.electron;
|
||||||
|
|
||||||
export { isNodeJS };
|
export { isNodeJS };
|
||||||
|
@ -46,7 +46,7 @@ function group(stats, groupBy) {
|
|||||||
if (vals[key] === undefined) {
|
if (vals[key] === undefined) {
|
||||||
vals[key] = [];
|
vals[key] = [];
|
||||||
}
|
}
|
||||||
vals[key].push(curStat["time"]);
|
vals[key].push(curStat.time);
|
||||||
}
|
}
|
||||||
return vals;
|
return vals;
|
||||||
}
|
}
|
||||||
@ -58,14 +58,14 @@ function group(stats, groupBy) {
|
|||||||
function flatten(stats) {
|
function flatten(stats) {
|
||||||
var rows = [];
|
var rows = [];
|
||||||
stats.forEach(function (curStat) {
|
stats.forEach(function (curStat) {
|
||||||
curStat["stats"].forEach(function (s) {
|
curStat.stats.forEach(function (s) {
|
||||||
rows.push({
|
rows.push({
|
||||||
browser: curStat["browser"],
|
browser: curStat.browser,
|
||||||
page: curStat["page"],
|
page: curStat.page,
|
||||||
pdf: curStat["pdf"],
|
pdf: curStat.pdf,
|
||||||
round: curStat["round"],
|
round: curStat.round,
|
||||||
stat: s["name"],
|
stat: s.name,
|
||||||
time: s["end"] - s["start"],
|
time: s.end - s.start,
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
@ -191,7 +191,7 @@ function examineRefImages() {
|
|||||||
server.port +
|
server.port +
|
||||||
"/test/resources/reftest-analyzer.html#web=/test/eq.log";
|
"/test/resources/reftest-analyzer.html#web=/test/eq.log";
|
||||||
var config = Object.assign({}, sessions[0].config);
|
var config = Object.assign({}, sessions[0].config);
|
||||||
config["headless"] = false;
|
config.headless = false;
|
||||||
var browser = WebBrowser.create(config);
|
var browser = WebBrowser.create(config);
|
||||||
browser.start(startUrl);
|
browser.start(startUrl);
|
||||||
}
|
}
|
||||||
@ -271,7 +271,7 @@ function startRefTest(masterMode, showRefImages) {
|
|||||||
|
|
||||||
startTime = Date.now();
|
startTime = Date.now();
|
||||||
startServer();
|
startServer();
|
||||||
server.hooks["POST"].push(refTestPostHandler);
|
server.hooks.POST.push(refTestPostHandler);
|
||||||
onAllSessionsClosed = finalize;
|
onAllSessionsClosed = finalize;
|
||||||
|
|
||||||
startBrowsers("/test/test_slave.html", function (session) {
|
startBrowsers("/test/test_slave.html", function (session) {
|
||||||
@ -692,7 +692,7 @@ function refTestPostHandler(req, res) {
|
|||||||
function startUnitTest(testUrl, name) {
|
function startUnitTest(testUrl, name) {
|
||||||
var startTime = Date.now();
|
var startTime = Date.now();
|
||||||
startServer();
|
startServer();
|
||||||
server.hooks["POST"].push(unitTestPostHandler);
|
server.hooks.POST.push(unitTestPostHandler);
|
||||||
onAllSessionsClosed = function () {
|
onAllSessionsClosed = function () {
|
||||||
stopServer();
|
stopServer();
|
||||||
var numRuns = 0,
|
var numRuns = 0,
|
||||||
|
@ -1116,15 +1116,15 @@ describe("api", function () {
|
|||||||
var promise = pdfDocument.getMetadata();
|
var promise = pdfDocument.getMetadata();
|
||||||
promise
|
promise
|
||||||
.then(function ({ info, metadata, contentDispositionFilename }) {
|
.then(function ({ info, metadata, contentDispositionFilename }) {
|
||||||
expect(info["Title"]).toEqual("Basic API Test");
|
expect(info.Title).toEqual("Basic API Test");
|
||||||
// Custom, non-standard, information dictionary entries.
|
// Custom, non-standard, information dictionary entries.
|
||||||
expect(info["Custom"]).toEqual(undefined);
|
expect(info.Custom).toEqual(undefined);
|
||||||
// The following are PDF.js specific, non-standard, properties.
|
// The following are PDF.js specific, non-standard, properties.
|
||||||
expect(info["PDFFormatVersion"]).toEqual("1.7");
|
expect(info.PDFFormatVersion).toEqual("1.7");
|
||||||
expect(info["IsLinearized"]).toEqual(false);
|
expect(info.IsLinearized).toEqual(false);
|
||||||
expect(info["IsAcroFormPresent"]).toEqual(false);
|
expect(info.IsAcroFormPresent).toEqual(false);
|
||||||
expect(info["IsXFAPresent"]).toEqual(false);
|
expect(info.IsXFAPresent).toEqual(false);
|
||||||
expect(info["IsCollectionPresent"]).toEqual(false);
|
expect(info.IsCollectionPresent).toEqual(false);
|
||||||
|
|
||||||
expect(metadata instanceof Metadata).toEqual(true);
|
expect(metadata instanceof Metadata).toEqual(true);
|
||||||
expect(metadata.get("dc:title")).toEqual("Basic API Test");
|
expect(metadata.get("dc:title")).toEqual("Basic API Test");
|
||||||
@ -1142,11 +1142,11 @@ describe("api", function () {
|
|||||||
return pdfDoc.getMetadata();
|
return pdfDoc.getMetadata();
|
||||||
})
|
})
|
||||||
.then(function ({ info, metadata, contentDispositionFilename }) {
|
.then(function ({ info, metadata, contentDispositionFilename }) {
|
||||||
expect(info["Creator"]).toEqual("TeX");
|
expect(info.Creator).toEqual("TeX");
|
||||||
expect(info["Producer"]).toEqual("pdfeTeX-1.21a");
|
expect(info.Producer).toEqual("pdfeTeX-1.21a");
|
||||||
expect(info["CreationDate"]).toEqual("D:20090401163925-07'00'");
|
expect(info.CreationDate).toEqual("D:20090401163925-07'00'");
|
||||||
// Custom, non-standard, information dictionary entries.
|
// Custom, non-standard, information dictionary entries.
|
||||||
const custom = info["Custom"];
|
const custom = info.Custom;
|
||||||
expect(typeof custom === "object" && custom !== null).toEqual(true);
|
expect(typeof custom === "object" && custom !== null).toEqual(true);
|
||||||
|
|
||||||
expect(custom["PTEX.Fullbanner"]).toEqual(
|
expect(custom["PTEX.Fullbanner"]).toEqual(
|
||||||
@ -1154,11 +1154,11 @@ describe("api", function () {
|
|||||||
"Version 3.141592-1.21a-2.2 (Web2C 7.5.4) kpathsea version 3.5.6"
|
"Version 3.141592-1.21a-2.2 (Web2C 7.5.4) kpathsea version 3.5.6"
|
||||||
);
|
);
|
||||||
// The following are PDF.js specific, non-standard, properties.
|
// The following are PDF.js specific, non-standard, properties.
|
||||||
expect(info["PDFFormatVersion"]).toEqual("1.4");
|
expect(info.PDFFormatVersion).toEqual("1.4");
|
||||||
expect(info["IsLinearized"]).toEqual(false);
|
expect(info.IsLinearized).toEqual(false);
|
||||||
expect(info["IsAcroFormPresent"]).toEqual(false);
|
expect(info.IsAcroFormPresent).toEqual(false);
|
||||||
expect(info["IsXFAPresent"]).toEqual(false);
|
expect(info.IsXFAPresent).toEqual(false);
|
||||||
expect(info["IsCollectionPresent"]).toEqual(false);
|
expect(info.IsCollectionPresent).toEqual(false);
|
||||||
|
|
||||||
expect(metadata).toEqual(null);
|
expect(metadata).toEqual(null);
|
||||||
expect(contentDispositionFilename).toEqual(null);
|
expect(contentDispositionFilename).toEqual(null);
|
||||||
@ -1176,11 +1176,11 @@ describe("api", function () {
|
|||||||
})
|
})
|
||||||
.then(function ({ info, metadata, contentDispositionFilename }) {
|
.then(function ({ info, metadata, contentDispositionFilename }) {
|
||||||
// The following are PDF.js specific, non-standard, properties.
|
// The following are PDF.js specific, non-standard, properties.
|
||||||
expect(info["PDFFormatVersion"]).toEqual(null);
|
expect(info.PDFFormatVersion).toEqual(null);
|
||||||
expect(info["IsLinearized"]).toEqual(false);
|
expect(info.IsLinearized).toEqual(false);
|
||||||
expect(info["IsAcroFormPresent"]).toEqual(false);
|
expect(info.IsAcroFormPresent).toEqual(false);
|
||||||
expect(info["IsXFAPresent"]).toEqual(false);
|
expect(info.IsXFAPresent).toEqual(false);
|
||||||
expect(info["IsCollectionPresent"]).toEqual(false);
|
expect(info.IsCollectionPresent).toEqual(false);
|
||||||
|
|
||||||
expect(metadata).toEqual(null);
|
expect(metadata).toEqual(null);
|
||||||
expect(contentDispositionFilename).toEqual(null);
|
expect(contentDispositionFilename).toEqual(null);
|
||||||
|
@ -47,7 +47,7 @@ describe("node_stream", function () {
|
|||||||
response.end(`File ${request.url} not found!`);
|
response.end(`File ${request.url} not found!`);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (!request.headers["range"]) {
|
if (!request.headers.range) {
|
||||||
const contentLength = stat.size;
|
const contentLength = stat.size;
|
||||||
const stream = fs.createReadStream(filePath);
|
const stream = fs.createReadStream(filePath);
|
||||||
response.writeHead(200, {
|
response.writeHead(200, {
|
||||||
@ -57,7 +57,7 @@ describe("node_stream", function () {
|
|||||||
});
|
});
|
||||||
stream.pipe(response);
|
stream.pipe(response);
|
||||||
} else {
|
} else {
|
||||||
const [start, end] = request.headers["range"]
|
const [start, end] = request.headers.range
|
||||||
.split("=")[1]
|
.split("=")[1]
|
||||||
.split("-")
|
.split("-")
|
||||||
.map(x => {
|
.map(x => {
|
||||||
|
@ -19,7 +19,7 @@ var TestReporter = function (browser, appPath) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
json["browser"] = browser;
|
json.browser = browser;
|
||||||
r.send(JSON.stringify(json));
|
r.send(JSON.stringify(json));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -33,7 +33,7 @@ var TestReporter = function (browser, appPath) {
|
|||||||
description,
|
description,
|
||||||
};
|
};
|
||||||
if (typeof error !== "undefined") {
|
if (typeof error !== "undefined") {
|
||||||
message["error"] = error;
|
message.error = error;
|
||||||
}
|
}
|
||||||
send("/submit_task_results", message);
|
send("/submit_task_results", message);
|
||||||
}
|
}
|
||||||
|
@ -107,7 +107,7 @@ describe("unicode", function () {
|
|||||||
});
|
});
|
||||||
|
|
||||||
it("should not normalize standard characters", function () {
|
it("should not normalize standard characters", function () {
|
||||||
expect(NormalizedUnicodes["A"]).toEqual(undefined);
|
expect(NormalizedUnicodes.A).toEqual(undefined);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -163,7 +163,7 @@ WebServer.prototype = {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
var range = req.headers["range"];
|
var range = req.headers.range;
|
||||||
if (range && !disableRangeRequests) {
|
if (range && !disableRangeRequests) {
|
||||||
var rangesMatches = /^bytes=(\d+)\-(\d+)?/.exec(range);
|
var rangesMatches = /^bytes=(\d+)\-(\d+)?/.exec(range);
|
||||||
if (!rangesMatches) {
|
if (!rangesMatches) {
|
||||||
@ -344,11 +344,11 @@ WebServer.prototype = {
|
|||||||
// http://localhost:8888/test/unit/unit_test.html?spec=Cross-origin
|
// http://localhost:8888/test/unit/unit_test.html?spec=Cross-origin
|
||||||
function crossOriginHandler(req, res) {
|
function crossOriginHandler(req, res) {
|
||||||
if (req.url === "/test/pdfs/basicapi.pdf?cors=withCredentials") {
|
if (req.url === "/test/pdfs/basicapi.pdf?cors=withCredentials") {
|
||||||
res.setHeader("Access-Control-Allow-Origin", req.headers["origin"]);
|
res.setHeader("Access-Control-Allow-Origin", req.headers.origin);
|
||||||
res.setHeader("Access-Control-Allow-Credentials", "true");
|
res.setHeader("Access-Control-Allow-Credentials", "true");
|
||||||
}
|
}
|
||||||
if (req.url === "/test/pdfs/basicapi.pdf?cors=withoutCredentials") {
|
if (req.url === "/test/pdfs/basicapi.pdf?cors=withoutCredentials") {
|
||||||
res.setHeader("Access-Control-Allow-Origin", req.headers["origin"]);
|
res.setHeader("Access-Control-Allow-Origin", req.headers.origin);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
34
web/app.js
34
web/app.js
@ -263,41 +263,35 @@ const PDFViewerApplication = {
|
|||||||
const hashParams = parseQueryString(hash),
|
const hashParams = parseQueryString(hash),
|
||||||
waitOn = [];
|
waitOn = [];
|
||||||
|
|
||||||
if (
|
if ("disableworker" in hashParams && hashParams.disableworker === "true") {
|
||||||
"disableworker" in hashParams &&
|
|
||||||
hashParams["disableworker"] === "true"
|
|
||||||
) {
|
|
||||||
waitOn.push(loadFakeWorker());
|
waitOn.push(loadFakeWorker());
|
||||||
}
|
}
|
||||||
if ("disablerange" in hashParams) {
|
if ("disablerange" in hashParams) {
|
||||||
AppOptions.set("disableRange", hashParams["disablerange"] === "true");
|
AppOptions.set("disableRange", hashParams.disablerange === "true");
|
||||||
}
|
}
|
||||||
if ("disablestream" in hashParams) {
|
if ("disablestream" in hashParams) {
|
||||||
AppOptions.set("disableStream", hashParams["disablestream"] === "true");
|
AppOptions.set("disableStream", hashParams.disablestream === "true");
|
||||||
}
|
}
|
||||||
if ("disableautofetch" in hashParams) {
|
if ("disableautofetch" in hashParams) {
|
||||||
AppOptions.set(
|
AppOptions.set(
|
||||||
"disableAutoFetch",
|
"disableAutoFetch",
|
||||||
hashParams["disableautofetch"] === "true"
|
hashParams.disableautofetch === "true"
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
if ("disablefontface" in hashParams) {
|
if ("disablefontface" in hashParams) {
|
||||||
AppOptions.set(
|
AppOptions.set("disableFontFace", hashParams.disablefontface === "true");
|
||||||
"disableFontFace",
|
|
||||||
hashParams["disablefontface"] === "true"
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
if ("disablehistory" in hashParams) {
|
if ("disablehistory" in hashParams) {
|
||||||
AppOptions.set("disableHistory", hashParams["disablehistory"] === "true");
|
AppOptions.set("disableHistory", hashParams.disablehistory === "true");
|
||||||
}
|
}
|
||||||
if ("webgl" in hashParams) {
|
if ("webgl" in hashParams) {
|
||||||
AppOptions.set("enableWebGL", hashParams["webgl"] === "true");
|
AppOptions.set("enableWebGL", hashParams.webgl === "true");
|
||||||
}
|
}
|
||||||
if ("verbosity" in hashParams) {
|
if ("verbosity" in hashParams) {
|
||||||
AppOptions.set("verbosity", hashParams["verbosity"] | 0);
|
AppOptions.set("verbosity", hashParams.verbosity | 0);
|
||||||
}
|
}
|
||||||
if ("textlayer" in hashParams) {
|
if ("textlayer" in hashParams) {
|
||||||
switch (hashParams["textlayer"]) {
|
switch (hashParams.textlayer) {
|
||||||
case "off":
|
case "off":
|
||||||
AppOptions.set("textLayerMode", TextLayerMode.DISABLE);
|
AppOptions.set("textLayerMode", TextLayerMode.DISABLE);
|
||||||
break;
|
break;
|
||||||
@ -305,7 +299,7 @@ const PDFViewerApplication = {
|
|||||||
case "shadow":
|
case "shadow":
|
||||||
case "hover":
|
case "hover":
|
||||||
const viewer = this.appConfig.viewerContainer;
|
const viewer = this.appConfig.viewerContainer;
|
||||||
viewer.classList.add("textLayer-" + hashParams["textlayer"]);
|
viewer.classList.add("textLayer-" + hashParams.textlayer);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -313,7 +307,7 @@ const PDFViewerApplication = {
|
|||||||
AppOptions.set("pdfBug", true);
|
AppOptions.set("pdfBug", true);
|
||||||
AppOptions.set("fontExtraProperties", true);
|
AppOptions.set("fontExtraProperties", true);
|
||||||
|
|
||||||
const enabled = hashParams["pdfbug"].split(",");
|
const enabled = hashParams.pdfbug.split(",");
|
||||||
waitOn.push(loadAndEnablePDFBug(enabled));
|
waitOn.push(loadAndEnablePDFBug(enabled));
|
||||||
}
|
}
|
||||||
// It is not possible to change locale for the (various) extension builds.
|
// It is not possible to change locale for the (various) extension builds.
|
||||||
@ -322,7 +316,7 @@ const PDFViewerApplication = {
|
|||||||
PDFJSDev.test("!PRODUCTION || GENERIC")) &&
|
PDFJSDev.test("!PRODUCTION || GENERIC")) &&
|
||||||
"locale" in hashParams
|
"locale" in hashParams
|
||||||
) {
|
) {
|
||||||
AppOptions.set("locale", hashParams["locale"]);
|
AppOptions.set("locale", hashParams.locale);
|
||||||
}
|
}
|
||||||
|
|
||||||
return Promise.all(waitOn).catch(reason => {
|
return Promise.all(waitOn).catch(reason => {
|
||||||
@ -1004,7 +998,7 @@ const PDFViewerApplication = {
|
|||||||
// To prevent displaying a partially filled loading bar permanently, we
|
// To prevent displaying a partially filled loading bar permanently, we
|
||||||
// hide it when no data has been loaded during a certain amount of time.
|
// hide it when no data has been loaded during a certain amount of time.
|
||||||
const disableAutoFetch = this.pdfDocument
|
const disableAutoFetch = this.pdfDocument
|
||||||
? this.pdfDocument.loadingParams["disableAutoFetch"]
|
? this.pdfDocument.loadingParams.disableAutoFetch
|
||||||
: AppOptions.get("disableAutoFetch");
|
: AppOptions.get("disableAutoFetch");
|
||||||
|
|
||||||
if (disableAutoFetch && percent) {
|
if (disableAutoFetch && percent) {
|
||||||
@ -1287,7 +1281,7 @@ const PDFViewerApplication = {
|
|||||||
|
|
||||||
let pdfTitle;
|
let pdfTitle;
|
||||||
|
|
||||||
const infoTitle = info && info["Title"];
|
const infoTitle = info && info.Title;
|
||||||
if (infoTitle) {
|
if (infoTitle) {
|
||||||
pdfTitle = infoTitle;
|
pdfTitle = infoTitle;
|
||||||
}
|
}
|
||||||
|
@ -519,10 +519,7 @@ class BaseViewer {
|
|||||||
|
|
||||||
// In addition to 'disableAutoFetch' being set, also attempt to reduce
|
// In addition to 'disableAutoFetch' being set, also attempt to reduce
|
||||||
// resource usage when loading *very* long/large documents.
|
// resource usage when loading *very* long/large documents.
|
||||||
if (
|
if (pdfDocument.loadingParams.disableAutoFetch || pagesCount > 7500) {
|
||||||
pdfDocument.loadingParams["disableAutoFetch"] ||
|
|
||||||
pagesCount > 7500
|
|
||||||
) {
|
|
||||||
// XXX: Printing is semi-broken with auto fetch disabled.
|
// XXX: Printing is semi-broken with auto fetch disabled.
|
||||||
this._pagesCapability.resolve();
|
this._pagesCapability.resolve();
|
||||||
return;
|
return;
|
||||||
|
@ -118,8 +118,8 @@ class PDFDocumentProperties {
|
|||||||
// just update the dialog immediately to avoid redundant lookups.
|
// just update the dialog immediately to avoid redundant lookups.
|
||||||
if (
|
if (
|
||||||
this.fieldData &&
|
this.fieldData &&
|
||||||
currentPageNumber === this.fieldData["_currentPageNumber"] &&
|
currentPageNumber === this.fieldData._currentPageNumber &&
|
||||||
pagesRotation === this.fieldData["_pagesRotation"]
|
pagesRotation === this.fieldData._pagesRotation
|
||||||
) {
|
) {
|
||||||
this._updateUI();
|
this._updateUI();
|
||||||
return;
|
return;
|
||||||
@ -186,11 +186,11 @@ class PDFDocumentProperties {
|
|||||||
return this._parseFileSize(length);
|
return this._parseFileSize(length);
|
||||||
})
|
})
|
||||||
.then(fileSize => {
|
.then(fileSize => {
|
||||||
if (fileSize === this.fieldData["fileSize"]) {
|
if (fileSize === this.fieldData.fileSize) {
|
||||||
return; // The fileSize has already been correctly set.
|
return; // The fileSize has already been correctly set.
|
||||||
}
|
}
|
||||||
const data = Object.assign(Object.create(null), this.fieldData);
|
const data = Object.assign(Object.create(null), this.fieldData);
|
||||||
data["fileSize"] = fileSize;
|
data.fileSize = fileSize;
|
||||||
|
|
||||||
freezeFieldData(data);
|
freezeFieldData(data);
|
||||||
this._updateUI();
|
this._updateUI();
|
||||||
|
@ -228,8 +228,8 @@ class PDFLinkService {
|
|||||||
if ("search" in params) {
|
if ("search" in params) {
|
||||||
this.eventBus.dispatch("findfromurlhash", {
|
this.eventBus.dispatch("findfromurlhash", {
|
||||||
source: this,
|
source: this,
|
||||||
query: params["search"].replace(/"/g, ""),
|
query: params.search.replace(/"/g, ""),
|
||||||
phraseSearch: params["phrase"] === "true",
|
phraseSearch: params.phrase === "true",
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
// borrowing syntax from "Parameters for Opening PDF Files"
|
// borrowing syntax from "Parameters for Opening PDF Files"
|
||||||
|
@ -66,7 +66,7 @@ function PDFPrintService(pdfDocument, pagesOverview, printContainer, l10n) {
|
|||||||
this.printContainer = printContainer;
|
this.printContainer = printContainer;
|
||||||
this.l10n = l10n || NullL10n;
|
this.l10n = l10n || NullL10n;
|
||||||
this.disableCreateObjectURL =
|
this.disableCreateObjectURL =
|
||||||
pdfDocument.loadingParams["disableCreateObjectURL"];
|
pdfDocument.loadingParams.disableCreateObjectURL;
|
||||||
this.currentPage = -1;
|
this.currentPage = -1;
|
||||||
// The temporary canvas where renderPage paints one page at a time.
|
// The temporary canvas where renderPage paints one page at a time.
|
||||||
this.scratchCanvas = document.createElement("canvas");
|
this.scratchCanvas = document.createElement("canvas");
|
||||||
|
Loading…
Reference in New Issue
Block a user