opentype.features.js
Version:
Library to list opentype fonts optional features.
40 lines (39 loc) • 1.25 kB
JavaScript
;
// The Substitution object provides utility methods to manipulate
// the GSUB substitution table.
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
var layout_1 = __importDefault(require("./layout"));
/**
* @exports opentype.Substitution
* @class
* @extends opentype.Layout
* @param {opentype.Font}
* @constructor
*/
function Substitution(font) {
layout_1.default.call(this, font, 'gsub');
}
Substitution.prototype = layout_1.default.prototype;
/**
* Create a default GSUB table.
* @return {Object} gsub - The GSUB table.
*/
Substitution.prototype.createDefaultTable = function () {
// Generate a default empty GSUB table with just a DFLT script and dflt lang sys.
return {
version: 1,
scripts: [{
tag: 'DFLT',
script: {
defaultLangSys: { reserved: 0, reqFeatureIndex: 0xffff, featureIndexes: [] },
langSysRecords: []
}
}],
features: [],
lookups: []
};
};
exports.default = Substitution;