// Ensure the [h/v]mtx tables contains the advance width and
// sidebearings information for numGlyphs in the maxp table
- font.pos = (font.start ? font.start : 0) + maxp.offset;
+ font.pos = (font.start || 0) + maxp.offset;
var version = int16(font.getBytes(4));
var numGlyphs = int16(font.getBytes(2));
return false;
}
return true;
- };
+ }
// The offsets object holds at the same time a representation of where
// to write the table entry information about a table and another offset
}
// Enter the translated string into the cache
- return charsCache[chars] = str;
+ return (charsCache[chars] = str);
}
};
r = ((value + r) * c1 + c2) & ((1 << 16) - 1);
}
return decryptedString.slice(discardNumber);
- };
+ }
/*
* CharStrings are encoded following the the CharString Encoding sequence
}
return { charstring: charstring, width: width, lsb: lsb };
- };
+ }
/*
* Returns an object containing a Subrs array and a CharStrings
for (var i = 0; i < array.length; i++)
array[i] = parseFloat(array[i] || 0);
return array;
- };
+ }
function readNumber(str, index) {
while (str[index] == ' ')
count++;
return parseFloat(str.substr(start, count) || 0);
- };
+ }
function isSeparator(c) {
return c == ' ' || c == '\n' || c == '\x0d';
- };
+ }
this.extractFontProgram = function t1_extractFontProgram(stream) {
var eexec = decrypt(stream, kEexecEncryptionKey, 4);
}
return program;
- },
+ };
this.extractFontHeader = function t1_extractFontHeader(stream, properties) {
var headerString = '';
'globalSubrs': this.createCFFIndexHeader([]),
'charset': (function charset(self) {
- var charset = '\x00'; // Encoding
+ var charsetString = '\x00'; // Encoding
var count = glyphs.length;
for (var i = 0; i < count; i++) {
if (index == -1)
index = 0;
- charset += String.fromCharCode(index >> 8, index & 0xff);
+ charsetString += String.fromCharCode(index >> 8, index & 0xff);
}
- return charset;
+ return charsetString;
})(this),
'charstrings': this.createCFFIndexHeader([[0x8B, 0x0E]].concat(glyphs),
this.properties = properties;
this.data = this.parse();
- };
+ }
constructor.prototype = {
parse: function cff_parse() {
case 21:
dict['nominalWidthX'] = value[0];
default:
- TODO('interpret top dict key');
+ TODO('interpret top dict key: ' + key);
}
}
return dict;
error('Incorrect byte');
}
return -1;
- };
+ }
function parseFloatOperand() {
var str = '';
str += lookup[b2];
}
return parseFloat(str);
- };
+ }
var operands = [];
var entries = [];
parseIndex: function cff_parseIndex(pos) {
var bytes = this.bytes;
var count = bytes[pos++] << 8 | bytes[pos++];
- if (count == 0) {
- var offsets = [];
- var end = pos;
- } else {
+ var offsets = [];
+ var end = pos;
+
+ if (count != 0) {
var offsetSize = bytes[pos++];
// add 1 for offset to determine size of last object
var startPos = pos + ((count + 1) * offsetSize) - 1;
- var offsets = [];
for (var i = 0, ii = count + 1; i < ii; ++i) {
var offset = 0;
for (var j = 0; j < offsetSize; ++j) {
}
offsets.push(startPos + offset);
}
- var end = offsets[count];
+ end = offsets[count];
}
return {