Fix a bunch of warnings from Firebug strict mode
This commit is contained in:
parent
86f197daba
commit
3955ed1b4c
27
fonts.js
27
fonts.js
@ -599,16 +599,16 @@ var Font = (function () {
|
||||
return font.getBytes();
|
||||
},
|
||||
|
||||
convert: function font_convert(name, font, properties) {
|
||||
convert: function font_convert(fontName, font, properties) {
|
||||
var otf = new Uint8Array(kMaxFontFileSize);
|
||||
|
||||
function createNameTable(name) {
|
||||
var names = [
|
||||
"See original licence", // Copyright
|
||||
name, // Font family
|
||||
fontName, // Font family
|
||||
"undefined", // Font subfamily (font weight)
|
||||
"uniqueID", // Unique ID
|
||||
name, // Full font name
|
||||
fontName, // Full font name
|
||||
"0.1", // Version
|
||||
"undefined", // Postscript name
|
||||
"undefined", // Trademark
|
||||
@ -616,7 +616,7 @@ var Font = (function () {
|
||||
"undefined" // Designer
|
||||
];
|
||||
|
||||
var name =
|
||||
var nameTable =
|
||||
"\x00\x00" + // format
|
||||
"\x00\x0A" + // Number of names Record
|
||||
"\x00\x7E"; // Storage
|
||||
@ -633,13 +633,13 @@ var Font = (function () {
|
||||
"\x00\x00" + // name ID
|
||||
string16(str.length) +
|
||||
string16(strOffset);
|
||||
name += nameRecord;
|
||||
nameTable += nameRecord;
|
||||
|
||||
strOffset += str.length;
|
||||
}
|
||||
|
||||
name += names.join("");
|
||||
return name;
|
||||
nameTable += names.join("");
|
||||
return nameTable;
|
||||
}
|
||||
|
||||
// Required Tables
|
||||
@ -885,6 +885,9 @@ var FontsUtils = {
|
||||
bytes.set([value >> 24, value >> 16, value >> 8, value]);
|
||||
return [bytes[0], bytes[1], bytes[2], bytes[3]];
|
||||
}
|
||||
|
||||
error("This number of bytes " + bytesCount + " is not supported");
|
||||
return null;
|
||||
},
|
||||
|
||||
bytesToInteger: function fu_bytesToInteger(bytesArray) {
|
||||
@ -1238,7 +1241,7 @@ var CFF = function(name, file, properties) {
|
||||
};
|
||||
|
||||
CFF.prototype = {
|
||||
createCFFIndexHeader: function(objects, isByte) {
|
||||
createCFFIndexHeader: function cff_createCFFIndexHeader(objects, isByte) {
|
||||
// First 2 bytes contains the number of objects contained into this index
|
||||
var count = objects.length;
|
||||
|
||||
@ -1275,18 +1278,18 @@ CFF.prototype = {
|
||||
return data;
|
||||
},
|
||||
|
||||
encodeNumber: function(value) {
|
||||
encodeNumber: function cff_encodeNumber(value) {
|
||||
var x = 0;
|
||||
if (value >= -32768 && value <= 32767) {
|
||||
return [ 28, value >> 8, value & 0xFF ];
|
||||
} else if (value >= (-2147483647-1) && value <= 2147483647) {
|
||||
return [ 0xFF, value >> 24, Value >> 16, value >> 8, value & 0xFF ];
|
||||
} else {
|
||||
error("Value: " + value + " is not allowed");
|
||||
}
|
||||
error("Value: " + value + " is not allowed");
|
||||
return null;
|
||||
},
|
||||
|
||||
getOrderedCharStrings: function(glyphs) {
|
||||
getOrderedCharStrings: function cff_getOrderedCharStrings(glyphs) {
|
||||
var charstrings = [];
|
||||
|
||||
for (var i = 0; i < glyphs.length; i++) {
|
||||
|
56
pdf.js
56
pdf.js
@ -71,14 +71,14 @@ var Stream = (function() {
|
||||
get length() {
|
||||
return this.end - this.start;
|
||||
},
|
||||
getByte: function() {
|
||||
getByte: function stream_getByte() {
|
||||
if (this.pos >= this.end)
|
||||
return;
|
||||
return null;
|
||||
return this.bytes[this.pos++];
|
||||
},
|
||||
// returns subarray of original buffer
|
||||
// should only be read
|
||||
getBytes: function(length) {
|
||||
getBytes: function stream_getBytes(length) {
|
||||
var bytes = this.bytes;
|
||||
var pos = this.pos;
|
||||
var strEnd = this.end;
|
||||
@ -93,28 +93,28 @@ var Stream = (function() {
|
||||
this.pos = end;
|
||||
return bytes.subarray(pos, end);
|
||||
},
|
||||
lookChar: function() {
|
||||
lookChar: function stream_lookChar() {
|
||||
if (this.pos >= this.end)
|
||||
return;
|
||||
return null;
|
||||
return String.fromCharCode(this.bytes[this.pos]);
|
||||
},
|
||||
getChar: function() {
|
||||
getChar: function stream_getChar() {
|
||||
if (this.pos >= this.end)
|
||||
return;
|
||||
return null;
|
||||
return String.fromCharCode(this.bytes[this.pos++]);
|
||||
},
|
||||
skip: function(n) {
|
||||
skip: function stream_skip(n) {
|
||||
if (!n)
|
||||
n = 1;
|
||||
this.pos += n;
|
||||
},
|
||||
reset: function() {
|
||||
reset: function stream_reset() {
|
||||
this.pos = this.start;
|
||||
},
|
||||
moveStart: function() {
|
||||
moveStart: function stream_moveStart() {
|
||||
this.start = this.pos;
|
||||
},
|
||||
makeSubStream: function(start, length, dict) {
|
||||
makeSubStream: function stream_makeSubstream(start, length, dict) {
|
||||
return new Stream(this.bytes.buffer, start, length, dict);
|
||||
}
|
||||
};
|
||||
@ -146,7 +146,7 @@ var DecodeStream = (function() {
|
||||
}
|
||||
|
||||
constructor.prototype = {
|
||||
ensureBuffer: function(requested) {
|
||||
ensureBuffer: function decodestream_ensureBuffer(requested) {
|
||||
var buffer = this.buffer;
|
||||
var current = buffer ? buffer.byteLength : 0;
|
||||
if (requested < current)
|
||||
@ -159,16 +159,16 @@ var DecodeStream = (function() {
|
||||
buffer2[i] = buffer[i];
|
||||
return this.buffer = buffer2;
|
||||
},
|
||||
getByte: function() {
|
||||
getByte: function decodestream_getByte() {
|
||||
var pos = this.pos;
|
||||
while (this.bufferLength <= pos) {
|
||||
if (this.eof)
|
||||
return;
|
||||
return null;
|
||||
this.readBlock();
|
||||
}
|
||||
return this.buffer[this.pos++];
|
||||
},
|
||||
getBytes: function(length) {
|
||||
getBytes: function decodestream_getBytes(length) {
|
||||
var pos = this.pos;
|
||||
|
||||
if (length) {
|
||||
@ -191,25 +191,25 @@ var DecodeStream = (function() {
|
||||
this.pos = end;
|
||||
return this.buffer.subarray(pos, end)
|
||||
},
|
||||
lookChar: function() {
|
||||
lookChar: function decodestream_lookChar() {
|
||||
var pos = this.pos;
|
||||
while (this.bufferLength <= pos) {
|
||||
if (this.eof)
|
||||
return;
|
||||
return null;
|
||||
this.readBlock();
|
||||
}
|
||||
return String.fromCharCode(this.buffer[this.pos]);
|
||||
},
|
||||
getChar: function() {
|
||||
getChar: function decodestream_getChar() {
|
||||
var pos = this.pos;
|
||||
while (this.bufferLength <= pos) {
|
||||
if (this.eof)
|
||||
return;
|
||||
return null;
|
||||
this.readBlock();
|
||||
}
|
||||
return String.fromCharCode(this.buffer[this.pos++]);
|
||||
},
|
||||
skip: function(n) {
|
||||
skip: function decodestream_skip(n) {
|
||||
if (!n)
|
||||
n = 1;
|
||||
this.pos += n;
|
||||
@ -635,6 +635,7 @@ var PredictorStream = (function() {
|
||||
var rowBytes = this.rowBytes = (columns * colors * bits + 7) >> 3;
|
||||
|
||||
DecodeStream.call(this);
|
||||
return this;
|
||||
}
|
||||
|
||||
constructor.prototype = Object.create(DecodeStream.prototype);
|
||||
@ -905,7 +906,9 @@ var Dict = (function() {
|
||||
|
||||
constructor.prototype = {
|
||||
get: function(key) {
|
||||
return this.map[key];
|
||||
if (key in this.map)
|
||||
return this.map[key];
|
||||
return null;
|
||||
},
|
||||
get2: function(key1, key2) {
|
||||
return this.get(key1) || this.get(key2);
|
||||
@ -1590,7 +1593,7 @@ var XRef = (function() {
|
||||
}
|
||||
|
||||
constructor.prototype = {
|
||||
readXRefTable: function(parser) {
|
||||
readXRefTable: function readXRefTable(parser) {
|
||||
var obj;
|
||||
while (true) {
|
||||
if (IsCmd(obj = parser.getObj(), "trailer"))
|
||||
@ -1661,7 +1664,7 @@ var XRef = (function() {
|
||||
|
||||
return dict;
|
||||
},
|
||||
readXRefStream: function(stream) {
|
||||
readXRefStream: function readXRefStream(stream) {
|
||||
var streamParameters = stream.parameters;
|
||||
var length = streamParameters.get("Length");
|
||||
var byteWidths = streamParameters.get("W");
|
||||
@ -1713,7 +1716,7 @@ var XRef = (function() {
|
||||
this.readXRef(prev);
|
||||
return streamParameters;
|
||||
},
|
||||
readXRef: function(startXRef) {
|
||||
readXRef: function readXref(startXRef) {
|
||||
var stream = this.stream;
|
||||
stream.pos = startXRef;
|
||||
var parser = new Parser(new Lexer(stream), true);
|
||||
@ -1731,6 +1734,7 @@ var XRef = (function() {
|
||||
return this.readXRefStream(obj);
|
||||
}
|
||||
error("Invalid XRef");
|
||||
return null;
|
||||
},
|
||||
getEntry: function(i) {
|
||||
var e = this.entries[i];
|
||||
@ -2396,7 +2400,7 @@ var CanvasGraphics = (function() {
|
||||
if (!fd)
|
||||
// XXX deprecated "special treatment" for standard
|
||||
// fonts? What do we need to do here?
|
||||
return;
|
||||
return null;
|
||||
var descriptor = xref.fetch(fd);
|
||||
|
||||
var fontName = descriptor.get("FontName");
|
||||
@ -3037,7 +3041,7 @@ var CanvasGraphics = (function() {
|
||||
this.restore();
|
||||
|
||||
TODO("Inverse pattern is painted");
|
||||
var pattern = this.ctx.createPattern(tmpCanvas, "repeat");
|
||||
pattern = this.ctx.createPattern(tmpCanvas, "repeat");
|
||||
this.ctx.fillStyle = pattern;
|
||||
},
|
||||
setStrokeGray: function(gray) {
|
||||
|
Loading…
Reference in New Issue
Block a user