readClassDef static method

List<int> readClassDef(
  1. Uint8List data,
  2. int offset
)

Implementation

static List<int> readClassDef(Uint8List data, int offset) {
  List<int> obj = [];
  final format = TyprBin.readUshort(data, offset);
  offset += 2;
  if (format == 1) {
    final startGlyph = TyprBin.readUshort(data, offset);
    offset += 2;
    final glyphCount = TyprBin.readUshort(data, offset);
    offset += 2;
    for (int i = 0; i < glyphCount; i++) {
      obj.add(startGlyph + i);
      obj.add(startGlyph + i);
      obj.add(TyprBin.readUshort(data, offset));
      offset += 2;
    }
  }
  if (format == 2) {
    final count = TyprBin.readUshort(data, offset);
    offset += 2;
    for (int i = 0; i < count; i++) {
      obj.add(TyprBin.readUshort(data, offset));
      offset += 2;
      obj.add(TyprBin.readUshort(data, offset));
      offset += 2;
      obj.add(TyprBin.readUshort(data, offset));
      offset += 2;
    }
  }
  return obj;
}