getCffIndexObject function

dynamic getCffIndexObject(
  1. dynamic i,
  2. dynamic offsets,
  3. dynamic data,
  4. dynamic start,
  5. Function? conversionFn,
)

Implementation

getCffIndexObject(i, offsets, data, start, Function? conversionFn) {
  var count = getCard16(data, start);
  var objectOffset = 0;
  if (count != 0) {
    var offsetSize = getByte(data, start + 2);
    objectOffset = start + ((count + 1) * offsetSize) + 2;
  }

  var value =
      getBytes(data, objectOffset + offsets[i], objectOffset + offsets[i + 1]);
  if (conversionFn != null) {
    value = conversionFn(value);
  }
  return value;
}