parseCoverage method

dynamic parseCoverage()

Implementation

parseCoverage() {
  var startOffset = this.offset + this.relativeOffset;
  var format = this.parseUShort();
  var count = this.parseUShort();
  if (format == 1) {
      return {
        "format": 1,
        "glyphs": this.parseUShortList(count)
      };
  } else if (format == 2) {
      var ranges = List<Map>.filled(count, {});
      for (var i = 0; i < count; i++) {
        ranges[i] = {
          "start": this.parseUShort(),
          "end": this.parseUShort(),
          "index": this.parseUShort()
        };
      }
      return {
        "format": 2,
        "ranges": ranges
      };
  }
  throw('0x' + startOffset.toString(16) + ': Coverage format must be 1 or 2.');
}