pdfkit
Version:
A PDF generation library for Node.js
64 lines (52 loc) • 2.3 kB
JavaScript
(function() {
var Data, MaxpTable, Table;
var __hasProp = Object.prototype.hasOwnProperty, __extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor; child.__super__ = parent.prototype; return child; };
Table = require('../table');
Data = require('../../data');
MaxpTable = (function() {
__extends(MaxpTable, Table);
function MaxpTable() {
MaxpTable.__super__.constructor.apply(this, arguments);
}
MaxpTable.prototype.parse = function(data) {
data.pos = this.offset;
this.version = data.readInt();
this.numGlyphs = data.readUInt16();
this.maxPoints = data.readUInt16();
this.maxContours = data.readUInt16();
this.maxCompositePoints = data.readUInt16();
this.maxComponentContours = data.readUInt16();
this.maxZones = data.readUInt16();
this.maxTwilightPoints = data.readUInt16();
this.maxStorage = data.readUInt16();
this.maxFunctionDefs = data.readUInt16();
this.maxInstructionDefs = data.readUInt16();
this.maxStackElements = data.readUInt16();
this.maxSizeOfInstructions = data.readUInt16();
this.maxComponentElements = data.readUInt16();
return this.maxComponentDepth = data.readUInt16();
};
MaxpTable.prototype.encode = function(ids) {
var table;
table = new Data;
table.writeInt(this.version);
table.writeUInt16(ids.length);
table.writeUInt16(this.maxPoints);
table.writeUInt16(this.maxContours);
table.writeUInt16(this.maxCompositePoints);
table.writeUInt16(this.maxComponentContours);
table.writeUInt16(this.maxZones);
table.writeUInt16(this.maxTwilightPoints);
table.writeUInt16(this.maxStorage);
table.writeUInt16(this.maxFunctionDefs);
table.writeUInt16(this.maxInstructionDefs);
table.writeUInt16(this.maxStackElements);
table.writeUInt16(this.maxSizeOfInstructions);
table.writeUInt16(this.maxComponentElements);
table.writeUInt16(this.maxComponentDepth);
return table.data;
};
return MaxpTable;
})();
module.exports = MaxpTable;
}).call(this);