expandCoverage method

dynamic expandCoverage(
  1. dynamic coverageTable
)

Returns the list of glyph indexes of a coverage table. Format 1: the list is stored raw Format 2: compact list as range records. @instance @param {Object} coverageTable @return {Array}

Implementation

expandCoverage(coverageTable) {
    if (coverageTable.format == 1) {
        return coverageTable.glyphs;
    } else {
        var glyphs = [];
        var ranges = coverageTable.ranges;
        for (var i = 0; i < ranges.length; i++) {
            var range = ranges[i];
            var start = range.start;
            var end = range.end;
            for (var j = start; j <= end; j++) {
                glyphs.add(j);
            }
        }
        return glyphs;
    }
}