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