1
0
Fork 0
mirror of https://github.com/mozilla/pdf.js.git synced 2025-04-26 10:08: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:
Jonas Jenwald 2017-06-02 11:16:24 +02:00
parent 593dec1bb7
commit a8c87f8019
29 changed files with 586 additions and 582 deletions

View file

@ -60,7 +60,7 @@ var FontFlags = {
Italic: 64,
AllCap: 65536,
SmallCap: 131072,
ForceBold: 262144
ForceBold: 262144,
};
var MacStandardGlyphOrdering = [
@ -347,7 +347,7 @@ var OpenTypeFileBuilder = (function OpenTypeFileBuilderClosure() {
return {
range: searchRange,
entry: log2,
rangeShift: entrySize * entriesCount - searchRange
rangeShift: entrySize * entriesCount - searchRange,
};
};
@ -436,7 +436,7 @@ var OpenTypeFileBuilder = (function OpenTypeFileBuilderClosure() {
throw new Error('Table ' + tag + ' already exists');
}
this.tables[tag] = data;
}
},
};
return OpenTypeFileBuilder;
@ -868,7 +868,7 @@ var Font = (function FontClosure() {
if (glyphs[charCode] >= numGlyphs) {
continue;
}
codes.push({ fontCharCode: charCode | 0, glyphId: glyphs[charCode] });
codes.push({ fontCharCode: charCode | 0, glyphId: glyphs[charCode], });
}
codes.sort(function fontGetRangesSort(a, b) {
return a.fontCharCode - b.fontCharCode;
@ -1047,7 +1047,7 @@ var Font = (function FontClosure() {
yMax: 0,
yMin: 0,
ascent: 0,
descent: 0
descent: 0,
};
var ulUnicodeRange1 = 0;
@ -1283,7 +1283,7 @@ var Font = (function FontClosure() {
numTables: ttf.getUint16(),
searchRange: ttf.getUint16(),
entrySelector: ttf.getUint16(),
rangeShift: ttf.getUint16()
rangeShift: ttf.getUint16(),
};
}
@ -1298,7 +1298,7 @@ var Font = (function FontClosure() {
platformId: -1,
encodingId: -1,
mappings: [],
hasShortCmap: false
hasShortCmap: false,
};
}
var segment;
@ -1362,7 +1362,7 @@ var Font = (function FontClosure() {
platformId: -1,
encodingId: -1,
mappings: [],
hasShortCmap: false
hasShortCmap: false,
};
}
@ -1383,7 +1383,7 @@ var Font = (function FontClosure() {
}
mappings.push({
charCode: j,
glyphId: index
glyphId: index,
});
}
hasShortCmap = true;
@ -1394,7 +1394,7 @@ var Font = (function FontClosure() {
font.getBytes(6); // skipping range fields
var segIndex, segments = [];
for (segIndex = 0; segIndex < segCount; segIndex++) {
segments.push({ end: font.getUint16() });
segments.push({ end: font.getUint16(), });
}
font.getUint16();
for (segIndex = 0; segIndex < segCount; segIndex++) {
@ -1470,7 +1470,7 @@ var Font = (function FontClosure() {
platformId: -1,
encodingId: -1,
mappings: [],
hasShortCmap: false
hasShortCmap: false,
};
}
@ -1838,7 +1838,7 @@ var Font = (function FontClosure() {
language: font.getUint16(),
name: font.getUint16(),
length: font.getUint16(),
offset: font.getUint16()
offset: font.getUint16(),
};
// using only Macintosh and Windows platform/encoding names
if ((r.platform === 1 && r.encoding === 0 && r.language === 0) ||
@ -2091,7 +2091,7 @@ var Font = (function FontClosure() {
functionsUsed: [],
functionsStackDeltas: [],
tooComplexToFollowFunctions: false,
hintsValid: true
hintsValid: true,
};
if (fpgm) {
sanitizeTTProgram(fpgm, ttContext);
@ -2254,7 +2254,7 @@ var Font = (function FontClosure() {
yMax: int16(tables['head'].data[42], tables['head'].data[43]),
yMin: signedInt16(tables['head'].data[38], tables['head'].data[39]),
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.
@ -2435,14 +2435,14 @@ var Font = (function FontClosure() {
this.toFontChar = newMapping.toFontChar;
tables['cmap'] = {
tag: 'cmap',
data: createCmapTable(newMapping.charCodeToGlyphId, numGlyphs)
data: createCmapTable(newMapping.charCodeToGlyphId, numGlyphs),
};
if (!tables['OS/2'] || !validateOS2Table(tables['OS/2'])) {
tables['OS/2'] = {
tag: 'OS/2',
data: createOS2Table(properties, newMapping.charCodeToGlyphId,
metricsOverride)
metricsOverride),
};
}
@ -2450,7 +2450,7 @@ var Font = (function FontClosure() {
if (!tables['post']) {
tables['post'] = {
tag: 'post',
data: createPostTable(properties)
data: createPostTable(properties),
};
}
@ -2472,7 +2472,7 @@ var Font = (function FontClosure() {
if (!tables['name']) {
tables['name'] = {
tag: 'name',
data: createNameTable(this.name)
data: createNameTable(this.name),
};
} else {
// ... using existing 'name' table as prototype
@ -2543,7 +2543,7 @@ var Font = (function FontClosure() {
}
var accentOffset = {
x: seac[0] * matrix[0] + seac[1] * matrix[2] + matrix[4],
y: seac[0] * matrix[1] + seac[1] * matrix[3] + matrix[5]
y: seac[0] * matrix[1] + seac[1] * matrix[3] + matrix[5],
};
var charCodes = getCharCodes(mapping, glyphId);
@ -2736,7 +2736,7 @@ var Font = (function FontClosure() {
fontCharCode = seac.baseFontCharCode;
accent = {
fontChar: String.fromCharCode(seac.accentFontCharCode),
offset: seac.accentOffset
offset: seac.accentOffset,
};
}
@ -2798,7 +2798,7 @@ var Font = (function FontClosure() {
// Enter the translated string into the cache
return (charsCache[charsCacheKey] = glyphs);
}
},
};
return Font;
@ -2816,8 +2816,8 @@ var ErrorFont = (function ErrorFontClosure() {
return [];
},
exportData: function ErrorFont_exportData() {
return {error: this.error};
}
return { error: this.error, };
},
};
return ErrorFont;
@ -3246,7 +3246,7 @@ var Type1Font = (function Type1FontClosure() {
var compiler = new CFFCompiler(cff);
return compiler.compile();
}
},
};
return Type1Font;
@ -3307,7 +3307,7 @@ var CFFFont = (function CFFFontClosure() {
var encoding = cff.encoding ? cff.encoding.encoding : null;
charCodeToGlyphId = type1FontGlyphMapping(properties, encoding, charsets);
return charCodeToGlyphId;
}
},
};
return CFFFont;