UNPKG

pdfkit

Version:

A PDF generation library for Node.js

68 lines (56 loc) 2.28 kB
(function() { var Data, HeadTable, 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'); HeadTable = (function() { __extends(HeadTable, Table); function HeadTable() { HeadTable.__super__.constructor.apply(this, arguments); } HeadTable.prototype.parse = function(data) { data.pos = this.offset; this.version = data.readInt(); this.revision = data.readInt(); this.checkSumAdjustment = data.readInt(); this.magicNumber = data.readInt(); this.flags = data.readShort(); this.unitsPerEm = data.readShort(); this.created = data.readLongLong(); this.modified = data.readLongLong(); this.xMin = data.readShort(); this.yMin = data.readShort(); this.xMax = data.readShort(); this.yMax = data.readShort(); this.macStyle = data.readShort(); this.lowestRecPPEM = data.readShort(); this.fontDirectionHint = data.readShort(); this.indexToLocFormat = data.readShort(); return this.glyphDataFormat = data.readShort(); }; HeadTable.prototype.encode = function(loca) { var table; table = new Data; table.writeInt(this.version); table.writeInt(this.revision); table.writeInt(this.checkSumAdjustment); table.writeInt(this.magicNumber); table.writeShort(this.flags); table.writeShort(this.unitsPerEm); table.writeLongLong(this.created); table.writeLongLong(this.modified); table.writeShort(this.xMin); table.writeShort(this.yMin); table.writeShort(this.xMax); table.writeShort(this.yMax); table.writeShort(this.macStyle); table.writeShort(this.lowestRecPPEM); table.writeShort(this.fontDirectionHint); table.writeShort(loca.type); table.writeShort(this.glyphDataFormat); return table.data; }; return HeadTable; })(); module.exports = HeadTable; }).call(this);