"6": -1, // seac
"7": -1, //sbw
+ "11": "sub",
"12": "div",
// callothersubr is a mechanism to make calls on the postscript
"rrcurveto": 8,
"callsubr": 10,
"return": 11,
+ "sub": [12, 11],
+ "div": [12, 12],
+ "pop": [1, 12, 18],
"endchar": 14,
"rmoveto": 21,
"hmoveto": 22,
// entry 3 can be replaced by {}
if (index == 3) {
if (!data) {
- charstring.splice(i - 2, 4, "pop", 3);
+ charstring.splice(i - 2, 4, 3);
i -= 3;
} else {
// 5 to remove the arguments, the callothersubr call and the pop command
charstring.splice(j, 1, 28, command >> 8, command);
j+= 2;
} else if (command.charAt) {
- var command = this.commandsMap[command];
- if (IsArray(command)) {
- charstring.splice(j - 1, 1, command[0], command[1]);
+ var cmd = this.commandsMap[command];
+ if (!cmd)
+ error(command);
+
+ if (IsArray(cmd)) {
+ charstring.splice(j, 1, cmd[0], cmd[1]);
j += 1;
} else {
- charstring[j] = command;
+ charstring[j] = cmd;
}
}
}