Fix a bunch of errors reported by OTS except the error about 3-0-4 MS symbol in cmap

This commit is contained in:
Vivien Nicolas 2011-06-12 01:51:27 +02:00
parent e0beef4e25
commit ce9224538e

View File

@ -926,7 +926,7 @@ Type1Font.prototype = {
}; };
// Encode the glyph and add it to the FUX // Encode the glyph and add it to the FUX
var r = [[0x40, 0xEA]]; var r = [[0x40, 0x0E]];
for (var i = 0; i < glyphs.length; i++) { for (var i = 0; i < glyphs.length; i++) {
var data = glyphs[i].slice(); var data = glyphs[i].slice();
var charstring = []; var charstring = [];
@ -1102,6 +1102,10 @@ Type1Font.prototype = {
var offset = aOffset; var offset = aOffset;
// length // length
// Per spec tables must be 4-bytes align so add some 0x00 if needed
while (aData.length & 3)
aData.push(0x00);
var length = aData.length; var length = aData.length;
// checksum // checksum
@ -1216,7 +1220,7 @@ Type1Font.prototype = {
0x00, 0x00, 0x00, 0x00, // checksumAdjustement 0x00, 0x00, 0x00, 0x00, // checksumAdjustement
0x5F, 0x0F, 0x3C, 0xF5, // magicNumber 0x5F, 0x0F, 0x3C, 0xF5, // magicNumber
0x00, 0x00, // Flags 0x00, 0x00, // Flags
0x00, 0x00, // unitsPerEM 0x00, 0x40, // unitsPerEM (>= 16 && <=16384)
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // created 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // created
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // modified 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // modified
0x00, 0x00, // xMin 0x00, 0x00, // xMin
@ -1255,7 +1259,9 @@ Type1Font.prototype = {
0x00, 0x00, // -reserved- 0x00, 0x00, // -reserved-
0x00, 0x00 // metricDataFormat 0x00, 0x00 // metricDataFormat
]; ];
hhea = hhea.concat(this.encodeNumber(charstrings.length, 2)); // numberOfHMetrics hhea = hhea.concat(this.integerToBytes(charstrings.length, 2)); // numberOfHMetrics
log(hhea);
var tableEntry = this.createTableEntry("hhea", virtualOffset, hhea); var tableEntry = this.createTableEntry("hhea", virtualOffset, hhea);
otf.set(tableEntry, currentOffset); otf.set(tableEntry, currentOffset);
currentOffset += tableEntry.length; currentOffset += tableEntry.length;