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
"undefined" // Designer
];
- var name =
+ var nameTable =
"\x00\x00" + // format
"\x00\x0A" + // Number of names Record
"\x00\x7E"; // Storage
"\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
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) {
};
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;
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++) {
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;
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);
}
};
}
constructor.prototype = {
- ensureBuffer: function(requested) {
+ ensureBuffer: function decodestream_ensureBuffer(requested) {
var buffer = this.buffer;
var current = buffer ? buffer.byteLength : 0;
if (requested < current)
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) {
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;
var rowBytes = this.rowBytes = (columns * colors * bits + 7) >> 3;
DecodeStream.call(this);
+ return this;
}
constructor.prototype = Object.create(DecodeStream.prototype);
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);
}
constructor.prototype = {
- readXRefTable: function(parser) {
+ readXRefTable: function readXRefTable(parser) {
var obj;
while (true) {
if (IsCmd(obj = parser.getObj(), "trailer"))
return dict;
},
- readXRefStream: function(stream) {
+ readXRefStream: function readXRefStream(stream) {
var streamParameters = stream.parameters;
var length = streamParameters.get("Length");
var byteWidths = streamParameters.get("W");
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);
return this.readXRefStream(obj);
}
error("Invalid XRef");
+ return null;
},
getEntry: function(i) {
var e = this.entries[i];
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");
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) {