getLigatures top-level property
List Function
(dynamic feature, dynamic script, dynamic language)
getLigatures
getter/setter pair
Implementation
Substitution.prototype.getLigatures = function(feature, script, language) {
const ligatures = [];
const lookupTables = this.getLookupTables(script, language, feature, 4);
for (let idx = 0; idx < lookupTables.length; idx++) {
const subtables = lookupTables[idx].subtables;
for (let i = 0; i < subtables.length; i++) {
const subtable = subtables[i];
const glyphs = this.expandCoverage(subtable.coverage);
const ligatureSets = subtable.ligatureSets;
for (let j = 0; j < glyphs.length; j++) {
const startGlyph = glyphs[j];
const ligSet = ligatureSets[j];
for (let k = 0; k < ligSet.length; k++) {
const lig = ligSet[k];
ligatures.push({
sub: [startGlyph].concat(lig.components),
by: lig.ligGlyph
});
}
}
}
}
return ligatures;
};