Browse Source

Undo last patch, it broke font rendering

Vivien Nicolas 14 years ago
parent
commit
2c4a0aa269
  1. 21
      pdf.js

21
pdf.js

@ -48,24 +48,26 @@ function shadow(obj, prop, value) {
} }
var Stream = (function() { var Stream = (function() {
function constructor(arrayBuffer, start, length, dict) { function constructor(arrayBuffer, dict) {
this.bytes = new Uint8Array(arrayBuffer); this.bytes = new Uint8Array(arrayBuffer);
this.start = start || 0; this.pos = 0;
this.pos = this.start; this.start = 0;
this.length = (start + length) || arrayBuffer.byteLength;
this.dict = dict; this.dict = dict;
} }
constructor.prototype = { constructor.prototype = {
get length() {
return this.bytes.length;
},
getByte: function() { getByte: function() {
var bytes = this.bytes; var bytes = this.bytes;
if (this.pos >= this.length) if (this.pos >= bytes.length)
return -1; return -1;
return bytes[this.pos++]; return bytes[this.pos++];
}, },
lookChar: function() { lookChar: function() {
var bytes = this.bytes; var bytes = this.bytes;
if (this.pos >= this.length) if (this.pos >= bytes.length)
return; return;
return String.fromCharCode(bytes[this.pos]); return String.fromCharCode(bytes[this.pos]);
}, },
@ -87,8 +89,11 @@ var Stream = (function() {
moveStart: function() { moveStart: function() {
this.start = this.pos; this.start = this.pos;
}, },
makeSubStream: function(start, length, dict) { makeSubStream: function(pos, length, dict) {
return new Stream(this.bytes.buffer, start, length, dict); var buffer = this.bytes.buffer;
if (length)
return new Stream(new Uint8Array(buffer, pos, length), dict);
return new Stream(new Uint8Array(buffer, pos), dict);
} }
}; };

Loading…
Cancel
Save