Merge pull request #15310 from Snuffleupagus/cff-parser-rm-closure
Remove the remaining closures in the `src/core/cff_parser.js` file
This commit is contained in:
commit
92edfb59f7
@ -107,8 +107,7 @@ const CFFStandardStrings = [
|
||||
|
||||
const NUM_STANDARD_CFF_STRINGS = 391;
|
||||
|
||||
const CFFParser = (function CFFParserClosure() {
|
||||
const CharstringValidationData = [
|
||||
const CharstringValidationData = [
|
||||
null,
|
||||
{ id: "hstem", min: 2, stackClearing: true, stem: true },
|
||||
null,
|
||||
@ -141,8 +140,9 @@ const CFFParser = (function CFFParserClosure() {
|
||||
{ id: "callgsubr", min: 1, undefStack: true },
|
||||
{ id: "vhcurveto", min: 4, resetStack: true },
|
||||
{ id: "hvcurveto", min: 4, resetStack: true },
|
||||
];
|
||||
const CharstringValidationData12 = [
|
||||
];
|
||||
|
||||
const CharstringValidationData12 = [
|
||||
null,
|
||||
null,
|
||||
null,
|
||||
@ -157,7 +157,7 @@ const CFFParser = (function CFFParserClosure() {
|
||||
id: "add",
|
||||
min: 2,
|
||||
stackDelta: -1,
|
||||
stackFn: function stack_div(stack, index) {
|
||||
stackFn(stack, index) {
|
||||
stack[index - 2] = stack[index - 2] + stack[index - 1];
|
||||
},
|
||||
},
|
||||
@ -165,7 +165,7 @@ const CFFParser = (function CFFParserClosure() {
|
||||
id: "sub",
|
||||
min: 2,
|
||||
stackDelta: -1,
|
||||
stackFn: function stack_div(stack, index) {
|
||||
stackFn(stack, index) {
|
||||
stack[index - 2] = stack[index - 2] - stack[index - 1];
|
||||
},
|
||||
},
|
||||
@ -173,7 +173,7 @@ const CFFParser = (function CFFParserClosure() {
|
||||
id: "div",
|
||||
min: 2,
|
||||
stackDelta: -1,
|
||||
stackFn: function stack_div(stack, index) {
|
||||
stackFn(stack, index) {
|
||||
stack[index - 2] = stack[index - 2] / stack[index - 1];
|
||||
},
|
||||
},
|
||||
@ -182,7 +182,7 @@ const CFFParser = (function CFFParserClosure() {
|
||||
id: "neg",
|
||||
min: 1,
|
||||
stackDelta: 0,
|
||||
stackFn: function stack_div(stack, index) {
|
||||
stackFn(stack, index) {
|
||||
stack[index - 1] = -stack[index - 1];
|
||||
},
|
||||
},
|
||||
@ -199,7 +199,7 @@ const CFFParser = (function CFFParserClosure() {
|
||||
id: "mul",
|
||||
min: 2,
|
||||
stackDelta: -1,
|
||||
stackFn: function stack_div(stack, index) {
|
||||
stackFn(stack, index) {
|
||||
stack[index - 2] = stack[index - 2] * stack[index - 1];
|
||||
},
|
||||
},
|
||||
@ -216,10 +216,9 @@ const CFFParser = (function CFFParserClosure() {
|
||||
{ id: "flex", min: 13, resetStack: true },
|
||||
{ id: "hflex1", min: 9, resetStack: true },
|
||||
{ id: "flex1", min: 11, resetStack: true },
|
||||
];
|
||||
];
|
||||
|
||||
// eslint-disable-next-line no-shadow
|
||||
class CFFParser {
|
||||
class CFFParser {
|
||||
constructor(file, properties, seacAnalysisEnabled) {
|
||||
this.bytes = file.getBytes();
|
||||
this.properties = properties;
|
||||
@ -752,11 +751,7 @@ const CFFParser = (function CFFParserClosure() {
|
||||
}
|
||||
|
||||
emptyPrivateDictionary(parentDict) {
|
||||
const privateDict = this.createDict(
|
||||
CFFPrivateDict,
|
||||
[],
|
||||
parentDict.strings
|
||||
);
|
||||
const privateDict = this.createDict(CFFPrivateDict, [], parentDict.strings);
|
||||
parentDict.setByKey(18, [0, 0]);
|
||||
parentDict.privateDict = privateDict;
|
||||
}
|
||||
@ -982,9 +977,7 @@ const CFFParser = (function CFFParserClosure() {
|
||||
|
||||
return new CFFFDSelect(format, fdSelect);
|
||||
}
|
||||
}
|
||||
return CFFParser;
|
||||
})();
|
||||
}
|
||||
|
||||
// Compact Font Format
|
||||
class CFF {
|
||||
@ -1189,8 +1182,7 @@ class CFFDict {
|
||||
}
|
||||
}
|
||||
|
||||
const CFFTopDict = (function CFFTopDictClosure() {
|
||||
const layout = [
|
||||
const CFFTopDictLayout = [
|
||||
[[12, 30], "ROS", ["sid", "sid", "num"], null],
|
||||
[[12, 20], "SyntheticBase", "num", null],
|
||||
[0, "version", "sid", null],
|
||||
@ -1229,24 +1221,20 @@ const CFFTopDict = (function CFFTopDictClosure() {
|
||||
[[12, 37], "FDSelect", "offset", null],
|
||||
[[12, 36], "FDArray", "offset", null],
|
||||
[[12, 38], "FontName", "sid", null],
|
||||
];
|
||||
let tables = null;
|
||||
];
|
||||
|
||||
// eslint-disable-next-line no-shadow
|
||||
class CFFTopDict extends CFFDict {
|
||||
constructor(strings) {
|
||||
if (tables === null) {
|
||||
tables = CFFDict.createTables(layout);
|
||||
class CFFTopDict extends CFFDict {
|
||||
static get tables() {
|
||||
return shadow(this, "tables", this.createTables(CFFTopDictLayout));
|
||||
}
|
||||
super(tables, strings);
|
||||
|
||||
constructor(strings) {
|
||||
super(CFFTopDict.tables, strings);
|
||||
this.privateDict = null;
|
||||
}
|
||||
}
|
||||
return CFFTopDict;
|
||||
})();
|
||||
}
|
||||
|
||||
const CFFPrivateDict = (function CFFPrivateDictClosure() {
|
||||
const layout = [
|
||||
const CFFPrivateDictLayout = [
|
||||
[6, "BlueValues", "delta", null],
|
||||
[7, "OtherBlues", "delta", null],
|
||||
[8, "FamilyBlues", "delta", null],
|
||||
@ -1265,21 +1253,18 @@ const CFFPrivateDict = (function CFFPrivateDictClosure() {
|
||||
[20, "defaultWidthX", "num", 0],
|
||||
[21, "nominalWidthX", "num", 0],
|
||||
[19, "Subrs", "offset", null],
|
||||
];
|
||||
let tables = null;
|
||||
];
|
||||
|
||||
// eslint-disable-next-line no-shadow
|
||||
class CFFPrivateDict extends CFFDict {
|
||||
constructor(strings) {
|
||||
if (tables === null) {
|
||||
tables = CFFDict.createTables(layout);
|
||||
class CFFPrivateDict extends CFFDict {
|
||||
static get tables() {
|
||||
return shadow(this, "tables", this.createTables(CFFPrivateDictLayout));
|
||||
}
|
||||
super(tables, strings);
|
||||
|
||||
constructor(strings) {
|
||||
super(CFFPrivateDict.tables, strings);
|
||||
this.subrsIndex = null;
|
||||
}
|
||||
}
|
||||
return CFFPrivateDict;
|
||||
})();
|
||||
}
|
||||
|
||||
const CFFCharsetPredefinedTypes = {
|
||||
ISO_ADOBE: 0,
|
||||
|
Loading…
Reference in New Issue
Block a user