getLookupTables method
dynamic
getLookupTables(
- dynamic script,
- dynamic language,
- dynamic feature,
- dynamic lookupType,
- bool create,
Get the lookup tables of a given type for a script/language/feature.
@instance
@param {string} script='DFLT'
@param {string} language='dlft'
@param {string} feature - 4-letter feature code
@param {number} lookupType - 1 to 9
@param {boolean} create - forces the creation of the lookup table if it doesn't exist, with no subtables.
@return {Object[]}
Implementation
getLookupTables(script, language, feature, lookupType, bool create) {
var featureTable = this.getFeatureTable(script, language, feature, create);
var tables = [];
if (featureTable != null) {
var lookupTable;
var lookupListIndexes = featureTable["lookupListIndexes"];
var allLookups = this.font.tables[this.tableName]["lookups"];
// lookupListIndexes are in no particular order, so use naive search.
for (var i = 0; i < lookupListIndexes.length; i++) {
lookupTable = allLookups[lookupListIndexes[i]];
if (lookupTable["lookupType"] == lookupType) {
tables.add(lookupTable);
}
}
if (tables.length == 0 && create) {
lookupTable = {
"lookupType": lookupType,
"lookupFlag": 0,
"subtables": [],
"markFilteringSet": null
};
var index = allLookups.length;
allLookups.add(lookupTable);
lookupListIndexes.add(index);
return [lookupTable];
}
}
return tables;
}