mirror of
https://github.com/mozilla/pdf.js.git
synced 2025-04-25 09:38:06 +02:00
Fix inconsistent spacing and trailing commas in objects in src/core/
files, so we can enable the comma-dangle
and object-curly-spacing
ESLint rules later on
*Unfortunately this patch is fairly big, even though it only covers the `src/core` folder, but splitting it even further seemed difficult.* http://eslint.org/docs/rules/comma-dangle http://eslint.org/docs/rules/object-curly-spacing Given that we currently have quite inconsistent object formatting, fixing this in *one* big patch probably wouldn't be feasible (since I cannot imagine anyone wanting to review that); hence I've opted to try and do this piecewise instead. Please note: This patch was created automatically, using the ESLint --fix command line option. In a couple of places this caused lines to become too long, and I've fixed those manually; please refer to the interdiff below for the only hand-edits in this patch. ```diff diff --git a/src/core/evaluator.js b/src/core/evaluator.js index abab9027..dcd3594b 100644 --- a/src/core/evaluator.js +++ b/src/core/evaluator.js @@ -2785,7 +2785,8 @@ var EvaluatorPreprocessor = (function EvaluatorPreprocessorClosure() { t['Tz'] = { id: OPS.setHScale, numArgs: 1, variableArgs: false, }; t['TL'] = { id: OPS.setLeading, numArgs: 1, 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['Td'] = { id: OPS.moveText, numArgs: 2, variableArgs: false, }; t['TD'] = { id: OPS.setLeadingMoveText, numArgs: 2, variableArgs: false, }; diff --git a/src/core/jbig2.js b/src/core/jbig2.js index 5a17d482..71671541 100644 --- a/src/core/jbig2.js +++ b/src/core/jbig2.js @@ -123,19 +123,22 @@ var Jbig2Image = (function Jbig2ImageClosure() { { x: -1, y: -1, }, { x: 0, y: -1, }, { x: 1, y: -1, }, { x: -2, y: 0, }, { x: -1, y: 0, }], [{ x: -3, y: -1, }, { x: -2, y: -1, }, { x: -1, y: -1, }, { x: 0, y: -1, }, - { x: 1, y: -1, }, { x: -4, y: 0, }, { x: -3, y: 0, }, { x: -2, y: 0, }, { x: -1, y: 0, }] + { x: 1, y: -1, }, { x: -4, y: 0, }, { x: -3, y: 0, }, { x: -2, y: 0, }, + { x: -1, y: 0, }] ]; var RefinementTemplates = [ { coding: [{ x: 0, y: -1, }, { x: 1, y: -1, }, { x: -1, y: 0, }], - reference: [{ x: 0, y: -1, }, { x: 1, y: -1, }, { x: -1, y: 0, }, { x: 0, y: 0, }, - { x: 1, y: 0, }, { x: -1, y: 1, }, { x: 0, y: 1, }, { x: 1, y: 1, }], + reference: [{ x: 0, y: -1, }, { x: 1, y: -1, }, { x: -1, y: 0, }, + { x: 0, y: 0, }, { x: 1, y: 0, }, { x: -1, y: 1, }, + { x: 0, y: 1, }, { x: 1, y: 1, }], }, { - coding: [{ x: -1, y: -1, }, { x: 0, y: -1, }, { x: 1, y: -1, }, { x: -1, y: 0, }], - reference: [{ x: 0, y: -1, }, { x: -1, y: 0, }, { x: 0, y: 0, }, { x: 1, y: 0, }, - { x: 0, y: 1, }, { x: 1, y: 1, }], + coding: [{ x: -1, y: -1, }, { x: 0, y: -1, }, { x: 1, y: -1, }, + { x: -1, y: 0, }], + reference: [{ x: 0, y: -1, }, { x: -1, y: 0, }, { x: 0, y: 0, }, + { x: 1, y: 0, }, { x: 0, y: 1, }, { x: 1, y: 1, }], } ]; ```
This commit is contained in:
parent
593dec1bb7
commit
a8c87f8019
29 changed files with 586 additions and 582 deletions
|
@ -40,7 +40,7 @@ var FontRendererFactory = (function FontRendererFactoryClosure() {
|
|||
p = start + offset + 14;
|
||||
ranges = [];
|
||||
for (i = 0; i < segCount; i++, p += 2) {
|
||||
ranges[i] = {end: getUshort(data, p)};
|
||||
ranges[i] = { end: getUshort(data, p), };
|
||||
}
|
||||
p += 2;
|
||||
for (i = 0; i < segCount; i++, p += 2) {
|
||||
|
@ -70,7 +70,7 @@ var FontRendererFactory = (function FontRendererFactoryClosure() {
|
|||
ranges.push({
|
||||
start: getLong(data, p),
|
||||
end: getLong(data, p + 4),
|
||||
idDelta: getLong(data, p + 8) - getLong(data, p)
|
||||
idDelta: getLong(data, p + 8) - getLong(data, p),
|
||||
});
|
||||
p += 12;
|
||||
}
|
||||
|
@ -88,7 +88,7 @@ var FontRendererFactory = (function FontRendererFactoryClosure() {
|
|||
glyphs: cff.charStrings.objects,
|
||||
subrs: (cff.topDict.privateDict && cff.topDict.privateDict.subrsIndex &&
|
||||
cff.topDict.privateDict.subrsIndex.objects),
|
||||
gsubrs: cff.globalSubrIndex && cff.globalSubrIndex.objects
|
||||
gsubrs: cff.globalSubrIndex && cff.globalSubrIndex.objects,
|
||||
};
|
||||
}
|
||||
|
||||
|
@ -139,13 +139,13 @@ var FontRendererFactory = (function FontRendererFactoryClosure() {
|
|||
|
||||
function compileGlyf(code, cmds, font) {
|
||||
function moveTo(x, y) {
|
||||
cmds.push({cmd: 'moveTo', args: [x, y]});
|
||||
cmds.push({ cmd: 'moveTo', args: [x, y], });
|
||||
}
|
||||
function lineTo(x, y) {
|
||||
cmds.push({cmd: 'lineTo', args: [x, y]});
|
||||
cmds.push({ cmd: 'lineTo', args: [x, y], });
|
||||
}
|
||||
function quadraticCurveTo(xa, ya, x, y) {
|
||||
cmds.push({cmd: 'quadraticCurveTo', args: [xa, ya, x, y]});
|
||||
cmds.push({ cmd: 'quadraticCurveTo', args: [xa, ya, x, y], });
|
||||
}
|
||||
|
||||
var i = 0;
|
||||
|
@ -191,11 +191,11 @@ var FontRendererFactory = (function FontRendererFactoryClosure() {
|
|||
}
|
||||
var subglyph = font.glyphs[glyphIndex];
|
||||
if (subglyph) {
|
||||
cmds.push({cmd: 'save'});
|
||||
cmds.push({cmd: 'transform',
|
||||
args: [scaleX, scale01, scale10, scaleY, x, y]});
|
||||
cmds.push({ cmd: 'save', });
|
||||
cmds.push({ cmd: 'transform',
|
||||
args: [scaleX, scale01, scale10, scaleY, x, y], });
|
||||
compileGlyf(subglyph, cmds, font);
|
||||
cmds.push({cmd: 'restore'});
|
||||
cmds.push({ cmd: 'restore', });
|
||||
}
|
||||
} while ((flags & 0x20));
|
||||
} else {
|
||||
|
@ -267,7 +267,7 @@ var FontRendererFactory = (function FontRendererFactoryClosure() {
|
|||
var p = {
|
||||
flags: 1,
|
||||
x: (contour[0].x + contour[contour.length - 1].x) / 2,
|
||||
y: (contour[0].y + contour[contour.length - 1].y) / 2
|
||||
y: (contour[0].y + contour[contour.length - 1].y) / 2,
|
||||
};
|
||||
contour.unshift(p);
|
||||
contour.push(p);
|
||||
|
@ -297,13 +297,13 @@ var FontRendererFactory = (function FontRendererFactoryClosure() {
|
|||
var stems = 0;
|
||||
|
||||
function moveTo(x, y) {
|
||||
cmds.push({cmd: 'moveTo', args: [x, y]});
|
||||
cmds.push({ cmd: 'moveTo', args: [x, y], });
|
||||
}
|
||||
function lineTo(x, y) {
|
||||
cmds.push({cmd: 'lineTo', args: [x, y]});
|
||||
cmds.push({ cmd: 'lineTo', args: [x, y], });
|
||||
}
|
||||
function bezierCurveTo(x1, y1, x2, y2, x, y) {
|
||||
cmds.push({cmd: 'bezierCurveTo', args: [x1, y1, x2, y2, x, y]});
|
||||
cmds.push({ cmd: 'bezierCurveTo', args: [x1, y1, x2, y2, x, y], });
|
||||
}
|
||||
|
||||
function parse(code) {
|
||||
|
@ -432,12 +432,12 @@ var FontRendererFactory = (function FontRendererFactoryClosure() {
|
|||
var bchar = stack.pop();
|
||||
y = stack.pop();
|
||||
x = stack.pop();
|
||||
cmds.push({cmd: 'save'});
|
||||
cmds.push({cmd: 'translate', args: [x, y]});
|
||||
cmds.push({ cmd: 'save', });
|
||||
cmds.push({ cmd: 'translate', args: [x, y], });
|
||||
var cmap = lookupCmap(font.cmap, String.fromCharCode(
|
||||
font.glyphNameMap[StandardEncoding[achar]]));
|
||||
compileCharString(font.glyphs[cmap.glyphId], cmds, font);
|
||||
cmds.push({cmd: 'restore'});
|
||||
cmds.push({ cmd: 'restore', });
|
||||
|
||||
cmap = lookupCmap(font.cmap, String.fromCharCode(
|
||||
font.glyphNameMap[StandardEncoding[bchar]]));
|
||||
|
@ -616,13 +616,13 @@ var FontRendererFactory = (function FontRendererFactoryClosure() {
|
|||
}
|
||||
|
||||
var cmds = [];
|
||||
cmds.push({cmd: 'save'});
|
||||
cmds.push({cmd: 'transform', args: this.fontMatrix.slice()});
|
||||
cmds.push({cmd: 'scale', args: ['size', '-size']});
|
||||
cmds.push({ cmd: 'save', });
|
||||
cmds.push({ cmd: 'transform', args: this.fontMatrix.slice(), });
|
||||
cmds.push({ cmd: 'scale', args: ['size', '-size'], });
|
||||
|
||||
this.compileGlyphImpl(code, cmds);
|
||||
|
||||
cmds.push({cmd: 'restore'});
|
||||
cmds.push({ cmd: 'restore', });
|
||||
|
||||
return cmds;
|
||||
},
|
||||
|
@ -635,7 +635,7 @@ var FontRendererFactory = (function FontRendererFactoryClosure() {
|
|||
var cmap = lookupCmap(this.cmap, unicode);
|
||||
return (this.compiledGlyphs[cmap.glyphId] !== undefined &&
|
||||
this.compiledCharCodeToGlyphId[cmap.charCode] !== undefined);
|
||||
}
|
||||
},
|
||||
};
|
||||
|
||||
function TrueTypeCompiled(glyphs, cmap, fontMatrix) {
|
||||
|
@ -649,7 +649,7 @@ var FontRendererFactory = (function FontRendererFactoryClosure() {
|
|||
Util.inherit(TrueTypeCompiled, CompiledFont, {
|
||||
compileGlyphImpl(code, cmds) {
|
||||
compileGlyf(code, cmds, this);
|
||||
}
|
||||
},
|
||||
});
|
||||
|
||||
function Type2Compiled(cffInfo, cmap, fontMatrix, glyphNameMap) {
|
||||
|
@ -671,7 +671,7 @@ var FontRendererFactory = (function FontRendererFactoryClosure() {
|
|||
Util.inherit(Type2Compiled, CompiledFont, {
|
||||
compileGlyphImpl(code, cmds) {
|
||||
compileCharString(code, cmds, this);
|
||||
}
|
||||
},
|
||||
});
|
||||
|
||||
|
||||
|
@ -711,7 +711,7 @@ var FontRendererFactory = (function FontRendererFactoryClosure() {
|
|||
parseGlyfTable(glyf, loca, indexToLocFormat), cmap, fontMatrix);
|
||||
}
|
||||
return new Type2Compiled(cff, cmap, font.fontMatrix, font.glyphNameMap);
|
||||
}
|
||||
},
|
||||
};
|
||||
})();
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue