Browse Source

Clean up a bit the code to generate an OTF (again)

Vivien Nicolas 14 years ago
parent
commit
4039e3e1e2
  1. 28
      PDFFont.js

28
PDFFont.js

@ -238,15 +238,15 @@ Font.prototype = {
var otf = new Uint8Array(kMaxFontFileSize); var otf = new Uint8Array(kMaxFontFileSize);
// Required Tables // Required Tables
var CFF = aFont.data, var CFF = aFont.data, // PostScript Font Program
OS2 = [], OS2 = [], // OS/2 and Windows Specific metrics
cmap = [], cmap = [], // Character to glyphs mapping
head = [], head = [], // Font eader
hhea = [], hhea = [], // Horizontal header
hmtx = [], hmtx = [], // Horizontal metrics
maxp = [], maxp = [], // Maximum profile
name = [], name = [], // Naming tables
post = []; post = []; // PostScript informations
var tables = [CFF, OS2, cmap, head, hhea, hmtx, maxp, name, post]; var tables = [CFF, OS2, cmap, head, hhea, hmtx, maxp, name, post];
// The offsets object holds at the same time a representation of where // The offsets object holds at the same time a representation of where
@ -323,9 +323,9 @@ Font.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
0x03, 0xE8, // unitsPerEM (>= 16 && <=16384) 0x03, 0xE8, // unitsPerEM (defaulting to 1000)
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // created 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // creation date
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // modified 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // modifification date
0x00, 0x00, // xMin 0x00, 0x00, // xMin
0x00, 0x00, // yMin 0x00, 0x00, // yMin
0x00, 0x00, // xMax 0x00, 0x00, // xMax
@ -334,7 +334,7 @@ Font.prototype = {
0x00, 0x00, // lowestRecPPEM 0x00, 0x00, // lowestRecPPEM
0x00, 0x00, // fontDirectionHint 0x00, 0x00, // fontDirectionHint
0x00, 0x00, // indexToLocFormat 0x00, 0x00, // indexToLocFormat
0x00, 0x00 // glyphDataFormat 0x00, 0x00 // glyphDataFormat
]; ];
this._createTableEntry(otf, offsets, "head", head); this._createTableEntry(otf, offsets, "head", head);
@ -405,7 +405,7 @@ Font.prototype = {
]; ];
this._createTableEntry(otf, offsets, "post", post); this._createTableEntry(otf, offsets, "post", post);
// Once all the table entry are written, this is time to dump the data! // Once all the table entries header are written, dump the data!
var tables = [CFF, OS2, cmap, head, hhea, hmtx, maxp, name, post]; var tables = [CFF, OS2, cmap, head, hhea, hmtx, maxp, name, post];
for (var i = 0; i < tables.length; i++) { for (var i = 0; i < tables.length; i++) {
var table = tables[i]; var table = tables[i];

Loading…
Cancel
Save