1
0
Fork 0
mirror of https://github.com/mozilla/pdf.js.git synced 2025-04-22 16:18:08 +02:00

Merge pull request #1457 from gigaherz/closure-compiler

Fixes to allow compiling with Closure Compiler
This commit is contained in:
notmasteryet 2012-03-31 14:42:15 -07:00
commit 512997a5af
4 changed files with 30 additions and 30 deletions

View file

@ -752,7 +752,7 @@ var CanvasGraphics = (function CanvasGraphicsClosure() {
continue;
}
var char = glyph.fontChar;
var character = glyph.fontChar;
var charWidth = glyph.width * fontSize * 0.001 +
Util.sign(current.fontMatrix[0]) * charSpacing;
@ -762,16 +762,16 @@ var CanvasGraphics = (function CanvasGraphicsClosure() {
default: // other unsupported rendering modes
case TextRenderingMode.FILL:
case TextRenderingMode.FILL_ADD_TO_PATH:
ctx.fillText(char, scaledX, 0);
ctx.fillText(character, scaledX, 0);
break;
case TextRenderingMode.STROKE:
case TextRenderingMode.STROKE_ADD_TO_PATH:
ctx.strokeText(char, scaledX, 0);
ctx.strokeText(character, scaledX, 0);
break;
case TextRenderingMode.FILL_STROKE:
case TextRenderingMode.FILL_STROKE_ADD_TO_PATH:
ctx.fillText(char, scaledX, 0);
ctx.strokeText(char, scaledX, 0);
ctx.fillText(character, scaledX, 0);
ctx.strokeText(character, scaledX, 0);
break;
case TextRenderingMode.INVISIBLE:
break;

View file

@ -536,9 +536,9 @@ var PartialEvaluator = (function PartialEvaluatorClosure() {
var cmap = cmapObj.getBytes(cmapObj.length);
for (var i = 0, ii = cmap.length; i < ii; i++) {
var byte = cmap[i];
if (byte == 0x20 || byte == 0x0D || byte == 0x0A ||
byte == 0x3C || byte == 0x5B || byte == 0x5D) {
var octet = cmap[i];
if (octet == 0x20 || octet == 0x0D || octet == 0x0A ||
octet == 0x3C || octet == 0x5B || octet == 0x5D) {
switch (token) {
case 'usecmap':
error('usecmap is not implemented');
@ -595,7 +595,7 @@ var PartialEvaluator = (function PartialEvaluatorClosure() {
tokens.push(token);
token = '';
}
switch (byte) {
switch (octet) {
case 0x5B:
// begin list parsing
tokens.push(beginArrayToken);
@ -609,7 +609,7 @@ var PartialEvaluator = (function PartialEvaluatorClosure() {
tokens.push(items);
break;
}
} else if (byte == 0x3E) {
} else if (octet == 0x3E) {
if (token.length) {
if (token.length <= 4) {
// parsing hex number
@ -635,7 +635,7 @@ var PartialEvaluator = (function PartialEvaluatorClosure() {
}
}
} else {
token += String.fromCharCode(byte);
token += String.fromCharCode(octet);
}
}
}

View file

@ -2861,7 +2861,7 @@ var Type1Parser = function type1Parser() {
subrs: [],
charstrings: [],
properties: {
'private': {
'privateData': {
'lenIV': 4
}
}
@ -2890,7 +2890,7 @@ var Type1Parser = function type1Parser() {
(token == 'RD' || token == '-|')) {
i++;
var data = eexec.slice(i, i + length);
var lenIV = program.properties.private['lenIV'];
var lenIV = program.properties.privateData['lenIV'];
var encoded = decrypt(data, kCharStringsEncryptionKey, lenIV);
var str = decodeCharString(encoded);
@ -2930,7 +2930,7 @@ var Type1Parser = function type1Parser() {
var length = parseInt(getToken(), 10);
getToken(); // read in 'RD'
var data = eexec.slice(i + 1, i + 1 + length);
var lenIV = program.properties.private['lenIV'];
var lenIV = program.properties.privateData['lenIV'];
var encoded = decrypt(data, kCharStringsEncryptionKey, lenIV);
var str = decodeCharString(encoded);
i = i + 1 + length;
@ -2946,12 +2946,12 @@ var Type1Parser = function type1Parser() {
case '/FamilyOtherBlues':
case '/StemSnapH':
case '/StemSnapV':
program.properties.private[token.substring(1)] =
program.properties.privateData[token.substring(1)] =
readNumberArray(eexecStr, i + 1);
break;
case '/StdHW':
case '/StdVW':
program.properties.private[token.substring(1)] =
program.properties.privateData[token.substring(1)] =
readNumberArray(eexecStr, i + 2)[0];
break;
case '/BlueShift':
@ -2960,7 +2960,7 @@ var Type1Parser = function type1Parser() {
case '/BlueScale':
case '/LanguageGroup':
case '/ExpansionFactor':
program.properties.private[token.substring(1)] =
program.properties.privateData[token.substring(1)] =
readNumber(eexecStr, i + 1);
break;
}
@ -2984,14 +2984,14 @@ var Type1Parser = function type1Parser() {
var count = headerString.length;
for (var i = 0; i < count; i++) {
var getToken = function getToken() {
var char = headerString[i];
while (i < count && (isSeparator(char) || char == '/'))
char = headerString[++i];
var character = headerString[i];
while (i < count && (isSeparator(character) || character == '/'))
character = headerString[++i];
var token = '';
while (i < count && !(isSeparator(char) || char == '/')) {
token += char;
char = headerString[++i];
while (i < count && !(isSeparator(character) || character == '/')) {
token += character;
character = headerString[++i];
}
return token;
@ -3357,7 +3357,7 @@ Type1Font.prototype = {
dict += self.encodeNumber(offset) + '\x11'; // Charstrings
offset = offset + fields.charstrings.length;
dict += self.encodeNumber(fields.private.length);
dict += self.encodeNumber(fields.privateData.length);
dict += self.encodeNumber(offset) + '\x12'; // Private
return header + String.fromCharCode(dict.length + 1) + dict;
@ -3398,7 +3398,7 @@ Type1Font.prototype = {
'charstrings': this.createCFFIndexHeader([[0x8B, 0x0E]].concat(glyphs),
true),
'private': (function cffWrapPrivate(self) {
'privateData': (function cffWrapPrivate(self) {
var data =
'\x8b\x14' + // defaultWidth
'\x8b\x15'; // nominalWidth
@ -3416,9 +3416,9 @@ Type1Font.prototype = {
ExpansionFactor: '\x0c\x18'
};
for (var field in fieldMap) {
if (!properties.private.hasOwnProperty(field))
if (!properties.privateData.hasOwnProperty(field))
continue;
var value = properties.private[field];
var value = properties.privateData[field];
if (isArray(value)) {
data += self.encodeNumber(value[0]);

View file

@ -122,9 +122,9 @@ function readFontDictData(aString, aMap) {
token = '';
var parsed = false;
while (!parsed) {
var byte = aString[i++];
var octet = aString[i++];
var nibbles = [parseInt(byte / 16, 10), parseInt(byte % 16, 10)];
var nibbles = [parseInt(octet / 16, 10), parseInt(octet % 16, 10)];
for (var j = 0; j < nibbles.length; j++) {
var nibble = nibbles[j];
switch (nibble) {
@ -336,7 +336,7 @@ var Type2Parser = function type2Parser(aFilePath) {
var privateDict = [];
for (var i = 0; i < priv.size; i++)
privateDict.push(aStream.getByte());
dump('private:' + privateDict);
dump('privateData:' + privateDict);
parseAsToken(privateDict, CFFDictPrivateDataMap);
for (var p in font.map)