UNPKG

pdfkit

Version:

A PDF generation library for Node.js

90 lines (79 loc) 2.91 kB
(function() { var OS2Table, 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'); OS2Table = (function() { __extends(OS2Table, Table); function OS2Table() { this.tag = 'OS/2'; OS2Table.__super__.constructor.apply(this, arguments); } OS2Table.prototype.parse = function(data) { var i; data.pos = this.offset; this.version = data.readUInt16(); this.averageCharWidth = data.readShort(); this.weightClass = data.readUInt16(); this.widthClass = data.readUInt16(); this.type = data.readShort(); this.ySubscriptXSize = data.readShort(); this.ySubscriptYSize = data.readShort(); this.ySubscriptXOffset = data.readShort(); this.ySubscriptYOffset = data.readShort(); this.ySuperscriptXSize = data.readShort(); this.ySuperscriptYSize = data.readShort(); this.ySuperscriptXOffset = data.readShort(); this.ySuperscriptYOffset = data.readShort(); this.yStrikeoutSize = data.readShort(); this.yStrikeoutPosition = data.readShort(); this.familyClass = data.readShort(); this.panose = (function() { var _results; _results = []; for (i = 0; i < 10; i++) { _results.push(data.readByte()); } return _results; })(); this.charRange = (function() { var _results; _results = []; for (i = 0; i < 4; i++) { _results.push(data.readInt()); } return _results; })(); this.vendorID = data.readString(4); this.selection = data.readShort(); this.firstCharIndex = data.readShort(); this.lastCharIndex = data.readShort(); if (this.version > 0) { this.ascent = data.readShort(); this.descent = data.readShort(); this.lineGap = data.readShort(); this.winAscent = data.readShort(); this.winDescent = data.readShort(); this.codePageRange = (function() { var _results; _results = []; for (i = 0; i < 2; i++) { _results.push(data.readInt()); } return _results; })(); if (this.version > 1) { this.xHeight = data.readShort(); this.capHeight = data.readShort(); this.defaultChar = data.readShort(); this.breakChar = data.readShort(); return this.maxContext = data.readShort(); } } }; OS2Table.prototype.encode = function() { return this.raw(); }; return OS2Table; })(); module.exports = OS2Table; }).call(this);